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(name='Pete', payday=as.Date('1999-01-01'))

+ )

> a

  name     payday

1  Tom 1999-01-01

2  Tom 2000-01-01

3 Pete 1998-01-01

4 Pete 1999-01-01

> aggregate(a$payday, list(a$name), max)

  Group.1     x

1     Tom 10957

2    Pete 10592

 

Thanks,

Richard

 


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to