powered by
Calculate sample ranks for ordinary vectors or for rvecs. In the case of rvecs, ranks are calculated independently for each draw.
rank( x, na.last = TRUE, ties.method = c("average", "first", "last", "random", "max", "min") )
An object of class rvec_int() if x is an rvec. Otherwise an ordinary integer vector.
rvec_int()
x
An ordinary vector or an rvec().
rvec()
Treatment of NAs. Options are TRUE, FALSE, or "keep". See base::rank() for details.
NA
TRUE
FALSE
"keep"
base::rank()
Treatment of ties. See base::rank() for details.
To enable different behavior for rvecs and for ordinary vectors, the base R function base::rank() is turned into a generic, with base::rank() as the default.
For details on the calculations, see the documentation for base::rank().
x <- rvec(list(c(3, 30), c(0, 100))) rank(x)
Run the code above in your browser using DataLab