# rev

0th

Percentile

##### Reverse Elements

rev provides a reversed version of its argument. It is generic function with a default method for vectors and one for dendrograms.

Note that this is no longer needed (nor efficient) for obtaining vectors sorted into descending order, since that is now rather more directly achievable by sort(x, decreasing = TRUE).

Keywords
manip
rev(x)
##### Arguments
x

a vector or another object for which reversal is defined.

##### References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

seq, sort.

• rev
• rev.default
##### Examples
library(base) # NOT RUN { x <- c(1:5, 5:3) ## sort into descending order; first more efficiently: stopifnot(sort(x, decreasing = TRUE) == rev(sort(x))) stopifnot(rev(1:7) == 7:1) #- don't need 'rev' here # }
Documentation reproduced from package base, version 3.5.3, License: Part of R 3.5.3

### Community examples

marti.cadek@gmail.com at Apr 5, 2017 base v3.3.3

# My Favourite Animals animals_ls = list(animals = c("Dog", "Elephant", "T-Rex"), intuitive_size = c("Small", "Medium", "Huge"), speed_in_km = c(55,40,40)) animals_ls # My Favourite Animals in reversed order reversed_animals_ls = rev(animals_ls) # Is it the same? identical(animals_ls, reversed_animals_ls) identical(animals_ls, animals_ls)