PercentRank.Rd
PercentRank()
takes a vector x
and returns the percentile that elements of x
correspond to.
PercentRank(x)
A numeric vector of the same length as x
with names copied from x
(unless na.last = NA
, when missing values are removed). The vector is of integer type unless x
is a long vector.
(r1 <- rank(x1 <- c(3, 1, 4, 15, 92)))
#> [1] 2 1 3 4 5
x2 <- c(3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5)
names(x2) <- letters[1:11]
(r2 <- rank(x2)) # ties are averaged
#> a b c d e f g h i j k
#> 4.5 1.5 6.0 1.5 8.0 11.0 3.0 10.0 8.0 4.5 8.0
PercentRank(x2)
#> a b c d e f g
#> 0.36363636 0.09090909 0.54545455 0.09090909 0.72727273 1.00000000 0.27272727
#> h i j k
#> 0.90909091 0.72727273 0.36363636 0.72727273