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, ...)
Details
This function automatically chooses from several low-level functions
considering the size of x
and the availability of a cache.
Suitable methods are
sortorderrnk()
(fast ordering)orderrnk()
(memory saving ordering).
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] 16.0 11.5 1.5 6.0 NA 11.5 19.5 4.0 19.5 NA 21.0 16.0 11.5 NA
#> [15] NA 16.0 8.5 NA NA 8.5 11.5 NA 1.5 NA NA 16.0 NA 4.0
#> [29] 7.0 16.0 NA 4.0
stopifnot(identical(rank.integer64(x), rank(as.integer(x)
, na.last="keep", ties.method = "average")))