Skip to content
Prev 327660 / 398503 Next

selection based on dates

I'm still a novice at R, so this may be a bit convoluted but it works:

colnames(x) = c("date", "id", "value")
do.call(rbind, (dlply(as.data.frame(x), .(id), function (y) 
y[-c(which(as.Date(y$date, "%m/%d/%y") == min(as.Date(y$date, 
"%m/%d/%y")), arr.ind=T)),])))
- FA

------ Original Message ------
From: "Andras Farkas" <motyocska at yahoo.com>
To: "r-help at r-project.org" <r-help at r-project.org>
Sent: 7/30/2013 8:13:21 AM
Subject: [R] selection based on dates