[R] how to fetch rows with certain characteristics

Waverley @ Palo Alto waverley.paloalto at gmail.com
Thu Oct 29 06:47:33 CET 2009


Hi,

I have a matrix, first column is of certain values, second column is
the class labels or a factor.
e.g.

1.2 1
1.3 1
1.3 1
1.5 1
2.1 2
2.0 2
9.9 2
1.4 3
1.8 3
1.9 3

I want to find out what is the min values of column 1 for each
corresponding class (column 2).  For the above example, I want to
return a matrix of
1.2 1
2.0 2
1.3 3

Can someone suggest how to code for that?  The second column can be of
characters.

Thanks much.


-- 
Waverley @ Palo Alto




More information about the R-help mailing list