For future reference you may want to look at the plyr package, or even the 
sapply and aggregate functions and possibly simpler ways to do what you did 
below.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Nick Ackerman
> Sent: Wednesday, March 17, 2010 11:45 AM
> To: r-help@r-project.org
> Subject: Re: [R] How can I return rows from a data frame with maximum
> value by factor?
> 
> 
> 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.
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to