Re: [R] Puzzled by results from base::rank()

2023-08-11 Thread Ebert,Timothy Aaron
you expand your example to generalize the outcome. Tim -Original Message- From: R-help On Behalf Of Gerrit Eichner Sent: Friday, August 11, 2023 4:32 AM To: r-help@r-project.org Subject: Re: [R] Puzzled by results from base::rank() [External Email] Dear Chris, the members of the tri

Re: [R] Puzzled by results from base::rank()

2023-08-11 Thread Gerrit Eichner
Dear Chris, the members of the triplet would be ranked 4, 5 and 6 (in your example), so the *mean of their ranks* is correctly 5. For any set of k tied values the ranks of its elements are averaged (and assigned to each of its k members). Hth -- Gerrit --

[R] Puzzled by results from base::rank()

2023-08-11 Thread Chris Evans via R-help
I understand that the default ties.method is "average".  Here is what I get, expanding a bit on the help page example. Running R 4.3.1 on Ubuntu 22.04.2. > x2 <- c(3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5) > rank(x2)  [1]  4.5  1.5  6.0  1.5  8.0 11.0  3.0 10.0  8.0  4.5  8.0 OK so the ties, each of wi