Hi,
You could do this either:
DF[unlist(with(DF,tapply(B,list(ID),FUN=function(x) x %in% max(x,]
#or
DF[unlist(with(DF,by(B,ID,FUN=function(x) x%in% max(x,]
#or
library(plyr)
DF[ddply(DF,.(ID),summarize,B %in% max(B))[,2],]
A.K.
Hi,
I am struggling with this issue and need some help
Lee wrote
> Hi,
>
> I am struggling with this issue and need some helps. The data set 'DF'
> includes persons' IDs and other variables A, B, and C. Each Person has
> multiple values in A, B, and C. What I am trying to do is 1) selecting a
> maximum value of B within same ID, and 2) making a new d
2 matches
Mail list logo