[R] function sort.list()

About this list Date view Thread view Subject view Author view Attachment view

From: Ole Christensen (o.christensen@lancaster.ac.uk)
Date: Mon 06 May 2002 - 19:50:11 EST


Message-id: <3CD651D3.91CC371E@lancs.ac.uk>

Derar R-people

I have troubles understanding what the function sort.list() is doing. On
the homepage it says that it returns a permutation which rearranges a
vector into ascending or descending order (like order() but on a vector
instead of a sequence).

> sort.list(c(0, 2, 10, 11, 4))
[1] 1 2 5 3 4

which does not make sense to me.

In fact I am getting the same (non-sensical) result using order()

order(c(0, 2, 10, 11, 4))
[1] 1 2 5 3 4

Of course

rank(c(0, 2, 10, 11, 4))
1] 1 2 4 5 3

gives the correct result.

Am I missing something obvious here ?

Cheers Ole

-- 
Ole F. Christensen
Department of Mathematics and Statistics
Fylde College, Lancaster University 
Lancaster, LA1 4YF, England
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Wed 16 Oct 2002 - 11:57:15 EST