File: reverse-methods.Rd

package info (click to toggle)
r-bioc-xvector 0.46.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 572 kB
  • sloc: ansic: 4,970; makefile: 2
file content (72 lines) | stat: -rw-r--r-- 1,560 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
\name{reverse-methods}

\alias{reverse-methods}

\alias{reverse,SharedRaw-method}
\alias{reverse,SharedVector_Pool-method}
\alias{reverse,XVector-method}
\alias{rev,XVector-method}
\alias{reverse,XVectorList-method}


\title{Reverse an XVector or XVectorList object}

\description{
  Methods for reversing an \link{XVector} or \link{XVectorList} object.
}

\usage{
\S4method{reverse}{XVector}(x, ...)
\S4method{reverse}{XVectorList}(x, ...)
}

\arguments{
  \item{x}{
    An \link{XVector} or \link{XVectorList} object.
  }
  \item{...}{
    Additional arguments. Currently ignored.
  }
}

\details{
  On an \link{XVector} object, \code{reverse} and \code{\link[base]{rev}}
  are equivalent, i.e. they both reverse the order of their elements.

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

\value{
  An object of the same class and length as the original object.
}

\seealso{
  \link{XVector-class},
  \link{XVectorList-class},
  \code{\link[S4Vectors]{endoapply}},
  \code{\link[base]{rev}}
}

\examples{
## 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)
}
}

\keyword{methods}
\keyword{manip}