Reverse an XVector or XVectorList object

Share:

Description

Methods for reversing an XVector or XVectorList object.

Usage

1
2
3
4
## S4 method for signature 'XVector'
reverse(x, ...)
## S4 method for signature 'XVectorList'
reverse(x, ...)

Arguments

x

An XVector or XVectorList object.

...

Additional arguments. Currently ignored.

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).

Value

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

See Also

XVector-class, XVectorList-class, endoapply, rev

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## 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)
}