Hola.
Esta es una manera:

require(data.table)
dt <-
data.table(v1=letters[1:30],v2=round(runif(30,max=20)),v3=rep(c("x","y","z"),10))
dt[unlist(dt[,.I[which.max(v2)],by=v3,drop=TRUE][,2])]

Saludos.

        [[alternative HTML version deleted]]

_______________________________________________
R-help-es mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-help-es

Responder a