[R] sorting ascending descending?

Jonathan Baron baron at cattell.psych.upenn.edu
Fri Jan 12 19:47:05 CET 2001


>From owner-r-help at stat.math.ethz.ch  Fri Jan 12 13:42:13 2001
>HI!
>By xx[order(xx)] I can sort the array ascendin. How to sort them
>descending.

>eg.:
>> a<-c(2,3,110,23,4)
>> a[order(a)]
>[1]   2   3   4  23 110
>
>but i wont.
>[1] 110  23   4   3   2

a[order(-a)]

or

-sort(-a)

Jon
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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