[R] Sort Problem

Sean Davis sdavis2 at mail.nih.gov
Thu Apr 6 14:17:06 CEST 2006




On 4/6/06 8:04 AM, "Sumanta Basak" <sumanta24 at gmail.com> wrote:

> Hi All,
> 
> 
> 
> I have certain combinations for which I have some value, e.g.
> 
> 
> 
> 0 1         20
> 
> 0 2         15
> 
> 1 1         40
> 
> 1 2         52
> 
> 
> 
> Now I need to sort this list for which I'll get the combination against the
> lowest value. In this case, 15, and the combination will be 0 2.

See ?order.  You can use the ordering that you get from order() to grab the
appropriate entry in your matrix/data.frame.

Sean




More information about the R-help mailing list