[R] Sort in descending order

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Dec 14 18:12:38 CET 2000



Kenneth Cabrera wrote:
> 
> Hi R users:
> I want to know how can I easily sort in descending order a
> whole data frame by one or several variables.
> Thank you very much for your help.

>From the help:
 order()
order returns a permutation which rearranges its first argument into
ascending order, breaking ties by further arguments. 

For descending order:
 rev(order(.....)) 

Hope this helps,
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list