[R] Follow-up Question: data frames; matching/merging

2010-02-08 Thread Jonathan
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 =

Re: [R] Follow-up Question: data frames; matching/merging

2010-02-08 Thread Gabor Grothendieck
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) V1