This help topic is for R version 1.7.1. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/rev.html
rev {base}R Documentation

Reverse a Vector's Elements

Description

rev provides a reversed version of its argument. It can be used in combination with sort to obtain vectors sorted into descending order.

Usage

rev(x)

Arguments

x

a vector.

References

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

See Also

seq, sort.

Examples

x <- c(1:5,5:3)
# sort into descending order
rev(sort(x))
stopifnot(rev(1:7) == 7:1)#- don't need `rev' here

[Package base version 1.7.1 ]