search for: lastd

Displaying 1 result from an estimated 1 matches for "lastd".

Did you mean: last
2012 Apr 04
2
Selecting obs within groups defined by 2 variables
...y real dataset, C2 is a date (mm/dd/yy) C1 C2 C3 1 x 1 1 x 2 1 y 1 1 y 2 2 x 1 2 x 2 2 y 1 2 y 2 I have found code (from UCLA R FAQs and this list's archives) for selecting the last observation when a group is defined by ONE variable (e.g., C1): last <-by(mydata, mydata$C1, tail, n=1) lastd<-do.call("rbind", as.list(last)) The by function does not seem to allow two variables in the Indices argument: last <-by(mydata, mydata$C1 mydata$C2, tail, n=1) THIS DOESN'T WORK I tried creating a new variable C1*C2, but I think this is risky since it may not be unique de...