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

vincent@7d4.com vincent at 7d4.com
Wed Sep 21 11:02:53 CEST 2005


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




More information about the R-help mailing list