Try RSiteSearch("Sort data frame").

Anyhow, use order() or sort.list() as follows:

dat[order(dat[,'myColumn']),]#Sorts data.frame dat by column "myColumn"
dat<-dat[sort.list(dat$myColumn, decreasing = T),] #Another option to do the 
same.  You can specify decreasing or increasing within both function

Cheers

Francisco

>From: Lisa Wang <[EMAIL PROTECTED]>
>To: R-Help <[email protected]>
>Subject: [R] How to sort a dataframe by one variable
>Date: Tue, 28 Jun 2005 17:39:40 -0400
>
>Hi there,
>
>Could anybody help me on how to sort a dataframe by one variable in the
>dataframe?
>
>Thank you
>
>Lisa Wang
>Princess Margaret Hospital
>Toronto, Ca
>tel: 416 946 4501
>
>______________________________________________
>[email protected] mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! 
>http://www.R-project.org/posting-guide.html

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to