[R] How can I return rows from a data frame with maximum value by factor?

Nick Ackerman nick.ackerman at pgn.com
Wed Mar 17 18:44:43 CET 2010


Solved my own question by looking at some other threads. For those who may be
intersted, here was the solution to my problem.

do.call(rbind,lapply(split(data.frame,FISH_ID),function(x)x[which.max(x$DATE_TIME),]))
-- 
View this message in context: http://n4.nabble.com/How-can-I-return-rows-from-a-data-frame-with-maximum-value-by-factor-tp1596777p1596853.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list