Displaying 1 result from an estimated 1 matches for "maxtsdf".
Did you mean:
maxsd
2006 Jan 10
1
Find last row (observation) for each combination of variables
...lso tried "by" but it's also slow.
My current (faster) solution is:
DF$abc<-paste(DF$A,DF$B,DF$C,sep="")
abclist<-unique(DF$ABC)
numtest<-length(abclist)
maxTS<-rep(0,numtest)
for(i in 1:numtest){
maxTS[i]<-max(DF$TS[DF$abc==abclist[i]],na.rm=TRUE)
}
maxTSdf<-data.frame(device=I(abc),maxTS=maxTS )
DF<-merge(DF,maxTSdf,by="abc",all.x=TRUE)
DF<-Df[DF$TS==DF$maxTS,,drop=TRUE]
DF$maxTS<-NULL
This seems a bit lengthy for such a simple task.
Any simpler suggestions?
-Leif K.
Leif Kirschenbaum
Senior Yield Engineer
Reflectivity, I...