Skip to content

Returns the sample ranks of the values in a vector. Ties (i.e., equal values) are averaged and missing values propagated.

Usage

# S3 method for class 'integer64'
rank(x, method = NULL, ...)

Arguments

x

a integer64 vector

method

NULL for automatic method selection or a suitable low-level method, see details

...

ignored

Value

A numeric vector of the same length as x.

Details

This function automatically chooses from several low-level functions considering the size of x and the availability of a cache. Suitable methods are

See also

order.integer64(), rank() and prank() for percent rank.

Examples

x <- as.integer64(sample(c(rep(NA, 9), 1:9), 32, TRUE))
rank.integer64(x)
#>  [1]   NA   NA  1.5   NA   NA  8.0 13.5   NA   NA 11.5   NA 10.0   NA
#> [14]  5.5   NA   NA   NA  1.5   NA   NA  8.0 13.5   NA 11.5   NA 16.0
#> [27] 15.0  8.0  3.5  5.5  3.5   NA

stopifnot(identical(rank.integer64(x),  rank(as.integer(x)
, na.last="keep", ties.method = "average")))