Reverse the Order of a Vector or List
DESCRIPTION:
Returns an object with the same length as
x
but with the elements
or components in the reverse order.
USAGE:
rev(x)
REQUIRED ARGUMENTS:
- x
-
an object with length, usually a vector or a
bdVector
.
Missing values (NA) are allowed.
VALUE:
object like
x
but with the order
reversed (the last value in
x
is the first value in the
result).
SEE ALSO:
,
,
,
.
EXAMPLES:
rev(sort(y)) # sort y in descending order
rev(list(a=1:2, b=5:6)) # same as list(b=5:6, a=1:2)