[R] R matrix sorting question
insu_paek@harcourt.com
insu_paek at harcourt.com
Thu May 19 19:42:33 CEST 2005
Dear there,
I am trying to do the following stuff. Could you let me know how to do
it efficiently?
> aaa
[,1] [,2]
[1,] 1 -0.2
[2,] 3 0.8
[3,] 4 0.3
[4,] 5 0.2
[5,] 7 0.9
And I would like to sort the matrix by column 2 (and accordingly column 1
sorted as well).
The desired matrix will be
1 -0.2
5 0.2
4 0.3
3 0.8
7 0.9
If using Excel or SAS, I can do this easily, but I couldn't figure out how
to do it in R.
Could you let me know the efficient way to do this ?
I appreciate if the solution or reply comes as quickly as possible.
Thank you very much.
Insu
More information about the R-help
mailing list