R: Reverse a Vector's Elements

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.

### 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 Contents]