Hi,
I'd like to select one row in a data frame per subset which is maximal for a particular value. I'm pretty close to the solution in the sense that I can easily select the maximal values per subset using "aggregate", but I can't really figure out how to select the rows in the original data frame that are associated with these maximal values. library(stats) # this returns the list with maximal values for breaks per wool/tension subset maxValues = aggregate(warpbreaks$breaks, list(wool = wool, tension = tension), max) # now i'd like the subset of the rows in warpbreaks that are associated with these maximal values Thank you in advance! Tim. [[alternative HTML version deleted]] ______________________________________________ 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.