Re: [R] Extracting day of month from Date objects

2011-05-24 Thread David Winsemius
On May 24, 2011, at 1:34 PM, Phil Spector wrote: I've always found the chron library to be useful for tasks like this: x <- round(runif(10)*10, digits=0) y <- as.Date(x, origin="1970-01-01") library(chron) days(y) [1] 7 25 26 25 10 24 1 31 12 8 31 Levels: 1 < 2 < 3 < 4 < 5 < 6 < 7 < 8

Re: [R] Extracting day of month from Date objects

2011-05-24 Thread Kang Min
Thanks Phil, chron is good. On May 25, 1:34 am, Phil Spector wrote: > I've always found the chron library to be useful for > tasks like this: > > > x <- round(runif(10)*10, digits=0) > > y <- as.Date(x, origin="1970-01-01") > > library(chron) > > days(y) > >   [1] 7  25 26 25 10 24 1  31 12 8

Re: [R] Extracting day of month from Date objects

2011-05-24 Thread Phil Spector
I've always found the chron library to be useful for tasks like this: x <- round(runif(10)*10, digits=0) y <- as.Date(x, origin="1970-01-01") library(chron) days(y) [1] 7 25 26 25 10 24 1 31 12 8 31 Levels: 1 < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < ... < 31 Notice that it

[R] Extracting day of month from Date objects ... was Re: grep pattern

2011-05-24 Thread David Winsemius
On May 24, 2011, at 10:19 AM, Kang Min wrote: I have another question - I'd like to extract dates from a vector of -mm-dd, so I just want the dd. x <- round(runif(10)*10, digits=0) y <- as.Date(x, origin="1970-01-01") I tried this based on the code that Jim provided, but it just prin