[R] sorting

threshold r.kozarski at gmail.com
Sun Jan 20 16:50:02 CET 2008


Hi, I want to sort my matrix according to (any) selected column. For example
given matrix:
> x
     [,1] [,2] [,3]
[1,]    3    4    7
[2,]    2    5    8
[3,]    1    6    9

I want to sort the first column in ascending order and make the other
columns follow the 'new order' like:

> x1
     [,1] [,2] [,3]
[1,]    1    6    9
[2,]    2    5    8
[3,]    3    4    7

thank in advance for help.

best




-- 
View this message in context: http://www.nabble.com/sorting-tp14983068p14983068.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list