Returns the sample ranks of the values in a vector. Ties (i.e., equal values) are averaged and missing values propagated.
# S3 method for class 'integer64'
rank(x, method = NULL, ...)A numeric vector of the same length as x.
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).
order.integer64(), rank() and prank() for percent rank.
x <- as.integer64(sample(c(rep(NA, 9), 1:9), 32, TRUE))
rank.integer64(x)
#> [1] NA 8.5 10.5 NA 1.5 NA NA 13.0 NA 4.0 7.0 13.0 NA 4.0 4.0
#> [16] NA 6.0 NA NA NA NA NA 10.5 NA 13.0 8.5 15.5 1.5 NA NA
#> [31] 15.5 NA
stopifnot(identical(rank.integer64(x), rank(as.integer(x)
, na.last="keep", ties.method = "average")))