Skip to content

sorting ascending descending?

5 messages · Wolski, Torsten Hothorn, Brian Ripley +2 more

#
HI!
By xx[order(xx)] I can sort the array ascendin. How to sort them
descending.

eg.:
[1]   2   3   4  23 110

but i wont.
[1] 110  23   4   3   2

???
THX in advance
Eryk

--
Witold Eryk Wolski
Max Plank Institut fuer Molekulare Genetik
Ihnestr73 14195 Berlin
Germany
tel.:
Work 0049-30-84131426
http://www.molgen.mpg.de/~wolski


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
rev(a[order(a)]

Torsten
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Fri, 12 Jan 2001, Torsten Hothorn wrote:

            
Or a[rev(order(a))], which is useful if you want to sort arrays not
vectors (just add a comma or two).
#
On Fri, 12 Jan 2001, Witold Eryk Wolski wrote:
You can do:

a[order(-a)]


Ramón
#
xx[rev(order(xx))]
On Fri, 12 Jan 2001, Witold Eryk Wolski wrote: