Re: [R] Sort a data frame with respect to more than one variable

From: <vincent_at_7d4.com>
Date: Wed 21 Sep 2005 - 19:02:53 EST

Marc Bernard a écrit :

> I know that for one variable X one may use:
 > df[order(df$X), ] where df is the data frame containing X.

probably not optimal, but simply why not ? dfX = df[order(df$X), ];
dfXY = dfX[order(dfX$Y), ];
hih



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 Sep 21 19:32:48 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 17:33:55 EST