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')),
+
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)
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
-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
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
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')),
+
6 matches
Mail list logo