[R] function sort.list()

Ole Christensen o.christensen at lancaster.ac.uk
Mon May 6 11:50:11 CEST 2002


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 at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list