Compute ranks
xrank(x, best = TRUE, na.rm = FALSE)
vector of values to be ranked
logical; if TRUE
(default), the rank of the j-th element is defined as the number of other elements strictly larger than the j-th. Otherwise, the rank is defined as the number of other elements strictly smaller than the j-th.
logical; if TRUE
, then NA
's are removed from x
(if any).
vector of the same dimension as x
containing the ranks
xrank(c(4,4,4,3,1,10,7,7))
#> [1] 4 4 4 7 8 1 2 2