[R] Double sort a data frame
andy_liaw at merck.com
Fri Feb 11 14:15:16 CET 2005
> From: Luis Ridao Cruz
> Long ago I asked how to sort a data frame according to one of the
> But Iwas wondering ho I could "double sort" , i.e, sort according to
> one column and another one afterwards.
> It is quite easy in Excel but I am unable to implemented in R.
Just as easy in R, if not easier. Something like:
dat[order(dat$col1, dat$col2), ]
> I have searched in the R help archives and found nothing.
This has been asked (and answered) numerous times on this list. There was a
function posted for Kevin Wright that implements a formula interface for
sorting data frames.
> Thank you in advance.
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide!
More information about the R-help