Compute the number of elements less or equal the elements in a given vector.

irank(x, ox = NULL)

Arguments

x

a numeric vector.

ox

order(x), optionally (for efficiency in case order(x) is already known).

Value

A vector of integers.

Examples

x <- rnorm(10)
irank(x)
#>  [1]  1  9  7  4  8  3  2  5  6 10
rank(x)
#>  [1]  1  9  7  4  8  3  2  5  6 10
x <- c(1,2,3,3,0)
irank(x)
#> [1] 2 3 5 5 1
rank(x)
#> [1] 2.0 3.0 4.5 4.5 1.0