[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')), +

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(your result)

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 work

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

2010-11-22 Thread David Winsemius
-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? On Nov 22, 2010, at 3:39 PM, Tan, Richard wrote

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

2010-11-22 Thread Tan, Richard
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 date in 1970. Since aggregate renames the date

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 r...@panagora.com 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')), +