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 ??? 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 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 2rev(a[order(a)] Torsten> > ??? > 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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:> > > 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 > > rev(a[order(a)] >Or a[rev(order(a))], which is useful if you want to sort arrays not vectors (just add a comma or two). -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>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 2a[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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Fri, 12 Jan 2001, Witold Eryk Wolski wrote:> 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 >You can do: a[order(-a)] Ramón -- Ramón Díaz-Uriarte Triana 47 28016 Madrid Spain email:ramon-diaz at teleline.es Phone: +-34-918-513-966 +-34-657-186-407 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
xx[rev(order(xx))] On Fri, 12 Jan 2001, Witold Eryk Wolski wrote:> 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 > > ??? > 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-- 318 Carr Hall bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._