Re: [R] How to sort a dataframe by one variable

From: Sundar Dorai-Raj <sundar.dorai-raj_at_pdf.com>
Date: Wed 29 Jun 2005 - 08:06:32 EST

Lisa Wang wrote:
> Hi there,
>
> Could anybody help me on how to sort a dataframe by one variable in the
> dataframe?
>
> Thank you
>

See ?order.

x <- data.frame(a = runif(10), b = 1:10) x[order(x$a), ]

--sundar



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 Wed Jun 29 08:21:58 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:06 EST