> class(df)
[1] data.frame

> names(df)
[1] "x" "y" "z"

df <- df[order(df$x, df$y),]            # sort df by x and y with priority to x



-----Message d'origine-----
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] la part de Luis Ridao Cruz
Envoye : vendredi 11 fevrier 2005 16:03
A : [email protected]
Objet : [R] Double sort a data frame


R-help,

Long ago I asked how to sort a data frame according to one of the
columns.
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.


I have searched in the R help archives and found nothing.


Thank you in advance.

______________________________________________
[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