rank {rvec} | R Documentation |
Sample Ranks, Including Rvecs
Description
Calculate sample ranks for ordinary vectors or for rvecs. In the case of rvecs, ranks are calculated independently for each draw.
Usage
rank(
x,
na.last = TRUE,
ties.method = c("average", "first", "last", "random", "max", "min")
)
Arguments
x |
An ordinary vector or an |
na.last |
Treatment of |
ties.method |
Treatment of ties.
See |
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()
.
Value
An object of class rvec_int()
if x
is
an rvec. Otherwise an ordinary integer vector.
Examples
x <- rvec(list(c(3, 30),
c(0, 100)))
rank(x)
[Package rvec version 0.0.6 Index]