Re: [R] aggregate a Date column does not work?

2010-11-22 Thread Gabor Grothendieck
On Mon, Nov 22, 2010 at 3:39 PM, Tan, Richard wrote: > Hi, I am trying to aggregate max a Date type column but have weird > result, how do I fix this? > >> a <- rbind( > > + data.frame(name='Tom', payday=as.Date('1999-01-01')), > + data.frame(name='Tom', payday=as.Date('2000-01-01')), > + data.fra

Re: [R] aggregate a Date column does not work?

2010-11-22 Thread Tan, Richard
onday, November 22, 2010 3:58 PM To: Tan, Richard Cc: r-help@r-project.org Subject: Re: [R] aggregate a Date column does not work? On Nov 22, 2010, at 3:54 PM, Tan, Richard wrote: > Thanks, add as.Date('1970-01-01') to the result column works. But that should make them all the same d

Re: [R] aggregate a Date column does not work?

2010-11-22 Thread David Winsemius
a$name), max)$x ) [1] "2000-01-01" "1999-01-01" Richard -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Monday, November 22, 2010 3:51 PM To: Tan, Richard Cc: r-help@r-project.org Subject: Re: [R] aggregate a Date column does not work? O

Re: [R] aggregate a Date column does not work?

2010-11-22 Thread Tan, Richard
Thanks, add as.Date('1970-01-01') to the result column works. Richard -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Monday, November 22, 2010 3:51 PM To: Tan, Richard Cc: r-help@r-project.org Subject: Re: [R] aggregate a Date column does not

Re: [R] aggregate a Date column does not work?

2010-11-22 Thread David Winsemius
On Nov 22, 2010, at 3:39 PM, Tan, Richard wrote: Hi, I am trying to aggregate max a Date type column but have weird result, how do I fix this? In the process of getting max() you coerced the Dates to numeric and now you need to re-coerce them back to Dates ?as.Date as.Date() (possibly wi

[R] aggregate a Date column does not work?

2010-11-22 Thread Tan, Richard
Hi, I am trying to aggregate max a Date type column but have weird result, how do I fix this? > a <- rbind( + data.frame(name='Tom', payday=as.Date('1999-01-01')), + data.frame(name='Tom', payday=as.Date('2000-01-01')), + data.frame(name='Pete', payday=as.Date('1998-01-01')), + data.frame(n