Learn R Programming

XVector (version 0.12.0)

reverse-methods: Reverse an XVector or XVectorList object

Description

Methods for reversing an XVector or XVectorList object.

Usage

"reverse"(x, ...) "reverse"(x, ...)

Arguments

x
An XVector or XVectorList object.
...
Additional arguments. Currently ignored.

Value

An object of the same class and length as the original object.

Details

On an XVector object, reverse and rev are equivalent, i.e. they both reverse the order of their elements.

On an XVectorList object, reverse reverses each element individually, without modifying the top-level order of the elements. It's equivalent to, but more efficient than, doing endoapply(x, rev).

See Also

XVector-class, XVectorList-class, endoapply, rev

Examples

Run this code
## On an XInteger object:
x <- as(12:-2, "XInteger")
reverse(x)

## On an XIntegerViews object:
v <- successiveViews(x, 1:5)
v
reverse(v)

## On an XVectorList object:
if (require(Biostrings) && require(drosophila2probe)) {
  library(Biostrings)
  library(drosophila2probe)
  probes <- DNAStringSet(drosophila2probe)
  reverse(probes)
}

Run the code above in your browser using DataLab