It works if you use character class rather than factors for your date
strings. Note last arg to data.frame:
> DF <- data.frame(V1=c(1,1,2,3,1,2),
+
V2=c('2002-03-13','1989-03-10','1988-01-20','1997-05-15','1996-11-18','2000-01-12'),
+ stringsAsFactors = FALSE)
> aggregate(DF[2], DF[1], min)
V
Wow.. thanks for the deluge of responses!
Aggregate seems like the way to go here.
But, suppose that instead of integers in column V2, I actually have
dates (and instead of keeping the minimum integer, I want to keep the
earliest date):
> df =
> data.frame(V1=c(1,1,2,3,1,2),V2=c('2002-03-13','1
2 matches
Mail list logo