reverse-methods: Reverse an XVector or XVectorList object

Description Usage Arguments Details Value See Also Examples

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

Example output

Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colMeans, colSums, colnames,
    dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
    intersect, is.unsorted, lapply, lengths, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
    rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which, which.max, which.min

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following object is masked from 'package:base':

    expand.grid

Loading required package: IRanges
XInteger of length 15
 [1] -2 -1  0  1  2  3  4  5  6  7  8  9 10 11 12
Views on a 15-integer XInteger subject
subject: 12 11 10  9  8  7  6  5  4  3  2  1  0 -1 -2
views:
    start end width
[1]     1   1     1 [12]
[2]     2   3     2 [11 10]
[3]     4   6     3 [9 8 7]
[4]     7  10     4 [6 5 4 3]
[5]    11  15     5 [ 2  1  0 -1 -2]
Views on a 15-integer XInteger subject
subject: -2 -1  0  1  2  3  4  5  6  7  8  9 10 11 12
views:
    start end width
[1]    15  15     1 [12]
[2]    13  14     2 [10 11]
[3]    10  12     3 [7 8 9]
[4]     6   9     4 [3 4 5 6]
[5]     1   5     5 [-2 -1  0  1  2]
Loading required package: Biostrings

Attaching package: 'Biostrings'

The following object is masked from 'package:base':

    strsplit

Loading required package: drosophila2probe
Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called 'drosophila2probe'

XVector documentation built on Nov. 8, 2020, 5:19 p.m.