Re: [R] sort a matrix on just one column

2003-09-10 Thread Petr Pikal
Hi

On 10 Sep 2003 at 10:50, Paul Green wrote:

> How can I sort(decreasing) a matrix on just the first column?
> For example, I can I get
> 
>8  2
>7  5
>4  1
> 
> from
> 
>7  5
>4  1
>8  2

I am sure in help pages for sort() is a link to order()

> mat
 x y
[1,] 7 5
[2,] 4 1
[3,] 8 2

> o<-order(mat[,1],decreasing=T)

> mat[o,]
 x y
[1,] 8 2
[2,] 7 5
[3,] 4 1


> 
> Thanks
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help

CheersPetr Pikal
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] sort a matrix on just one column

2003-09-10 Thread Paul Green
How can I sort(decreasing) a matrix on just the first column?
For example, I can I get
  8  2
  7  5
  4  1
from

  7  5
  4  1
  8  2
Thanks

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help