Re: [R] sort a table

From: Henrik Andersson <h.andersson_at_nioo.knaw.nl>
Date: Tue 26 Jul 2005 - 20:37:54 EST

herodote@oreka.com wrote:
> hi all,
>
> I need to sort a table like this one:
>
> n tmp s
> 1 215 0
> 2 654 1
> 3 213 0
> 4 569 1
> 5 954 1
> 6 562 1
> 7 252 0
> 8 555 0
> 9 988 1
>
test <- read.table("clipboard",header=T) test[order(test$tmp),]

   n tmp s
3 3 213 0
1 1 215 0
7 7 252 0
8 8 555 0
6 6 562 1
4 4 569 1
2 2 654 1
5 5 954 1
9 9 988 1

Happy?

Cheers, Henrik Andersson



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jul 26 20:44:16 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:34:01 EST