Re: [R] How to subset a data frame to include only first events

2013-02-05 Thread arun
1/14/2012","01/25/2012", "01/03/2012","01/08/2012","01/24/2012"),format="%m/%d/%Y") dat2<- data.frame(ID=rep(1:3,each=3),Date2)  aggregate(Date2~ID,data=dat2,head,1)  # ID      Date2 #1  1 2012-01-05 #2  2 2012-01-09 #3  3 2012-01-03 A.K.

[R] How to subset a data frame to include only first events

2013-02-05 Thread Dylan Arena
Hi there, I have data frame with columns ID and Date. There are multiple rows for each ID, but I only want to keep the *first* such row--i.e., the row corresponding to the earliest event. So if I had, say, 1000 rows of 100 IDs doing an average of ten events each, I'd run this trimming procedure

Re: [R] How to subset a data frame to include only first events

2013-02-05 Thread Dylan Arena
Update: A bit more digging and I found duplicated() ( http://tolstoy.newcastle.edu.au/R/e4/help/08/06/13592.html). Sorry for the premature request for help! On Mon, Feb 4, 2013 at 6:29 PM, Dylan Arena wrote: > Hi there, > > > I have data frame with columns ID and Date. There are multiple rows