[R] Problem with ties in rank()

arcriswell arc at arcriswell.com
Tue May 7 08:21:05 CEST 2002


Hello All:

I have a vector of data, z

> z
 [1] 0.1  0.1  0.1  0.1  0.2  0.2  0.3  0.3  0.3  0.4  0.5  0.5  0.5  0.7
0.7  0.7  0.9  0.9  1.1
[20] 1.1  1.2  1.3  1.4

The first 4 elements have values of 0.1 followed 2 elements with values 0.2.

When I invoke rank(z), I expected to get (1+2+3+4)/4 = 2.5 for the first 4
elements in the ranking and (5+6)/2 = 5.5 for elements 5 and 6. But what I
do get is the following.

> rank(z)
 [1]  1.5  1.5  3.5  3.5  5.0  6.0  8.0  8.0  8.0 10.0 12.0 12.0 12.0 15.0
15.0
[16] 15.0 17.5 17.5 19.5 19.5 21.0 22.0 23.0
>

Why is that???

I am using R 1.5.0 on Windows 2000.

Thanks,
ANDREW



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