[R] finding unique and max value from a data.frame

Srinivas Iyyer srini_iyyer_bio at yahoo.com
Fri Oct 24 02:30:32 CEST 2008


Hi group, 

How can I identify an element with max value among duplicated elements all in a data frame

Example:

> x1
  x1 x2
1  a  4
2  b  3
3  c  2
4  a  1
5  c  2
6  f  3
7  g  4
8  f  5


I want to be able to get a data frame with all unique(x1) with max value

  x1 x2
1  a  4
2  b  3
3  c  2
5  c  2
7  g  4
8  f  5


Could I get some help please. 
thanks
srini



More information about the R-help mailing list