[R] Sorting a data frame by one of the variables

Leaf Sun leaflovesun at yahoo.ca
Sun Oct 16 07:29:44 CEST 2005


Dear all,

I have a date frame like this:

X   Y   Z
22	24	4.3
2.3	3.4	5.3
.....
....
57.2	23.4	34

What my purpose is: to sort the data frame by either X, Y or Z.
sample output is (sorted by X) :

X   Y   Z
2.3  3.4  5.3
.....
......
22 24  4.3
...
57.2  23.4  34

I have no idea how to use sort, order or rank functions. Please help me out.
Thanks!

Leaf




More information about the R-help mailing list