Skip to contents

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

Usage

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  7  4  5  8  6  9  3  2 10
rank(x)
#>  [1]  1  7  4  5  8  6  9  3  2 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