rev
Reverse the Order of an Object
Description
Returns an object with the same length as x but with the elements or components in the reverse order.
Usage
rev(x)
Arguments
x |
an object with length. It is usually a vector, but it can also be a list or a general tree structure. Missing values (NA) are allowed.
|
Details
The rev function is generic; currently there is a default method.
Value
returns an object that is the same type as the input, with the difference that it reverses the order of the elements. That is, the last value in x becomes
the first value in the returned object. All attributes, except class, names, and row.names are removed.
See Also
Examples
y=runif(5)
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)