[R] Sorting matrices

Sundar Dorai-Raj sundar.dorai-raj at PDF.COM
Sat Aug 21 00:02:56 CEST 2004



Lana Schaffer wrote:

> Hi,
> I have been sorting matrices by sorting each column one at a time.
> However,
> Many times I want to sort the whole matrix by sorting one column.  Are
> there
> Ways to do this in R?
> Lana
> 

Lana,
   See ?order:

x[order(x[, 1]), ]

--sundar




More information about the R-help mailing list