Re: [R] Year and Month extraction from Date object.

2009-10-29 Thread Gavin Simpson
On Tue, 2009-10-27 at 14:49 -0700, rkevinbur...@charter.net wrote: > Hello, > > I have seen much discussion on Date. But I can't seem to do this > simple operation. I can convert a string to a date: > > d <- as.Date(DATE, format="%m/%d/%Y") > > But what I want to do is extract the year and mont

Re: [R] Year and Month extraction from Date object.

2009-10-27 Thread Prof Brian Ripley
?weekdays contains Note: Other components such as the day of the month or the year are very easy to compute: just use ‘as.POSIXlt’ and extract the relevant component. (d <- Sys.Date()) 1900 + as.POSIXlt(d)$year 1 + as.POSIXlt(d)$mon should get you started. On Tue, 27 Oct 2009,

[R] Year and Month extraction from Date object.

2009-10-27 Thread rkevinburton
Hello, I have seen much discussion on Date. But I can't seem to do this simple operation. I can convert a string to a date: d <- as.Date(DATE, format="%m/%d/%Y") But what I want to do is extract the year and month so I can construct an element in a ts object. Ideally I would like to see d$year