File: reverse-methods.Rd

package info (click to toggle)
r-bioc-iranges 2.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,808 kB
  • sloc: ansic: 4,789; sh: 4; makefile: 2
file content (73 lines) | stat: -rw-r--r-- 1,702 bytes parent folder | download | duplicates (4)
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
73
\name{reverse}

\alias{reverse}
\alias{reverse,character-method}
\alias{reverse,IRanges-method}
\alias{reverse,NormalIRanges-method}
\alias{reverse,Views-method}
\alias{reverse,MaskCollection-method}


\title{reverse}

\description{
  A generic function for reversing vector-like or list-like objects.
  This man page describes methods for reversing a character vector,
  a \link{Views} object, or a \link{MaskCollection} object.
  Note that \code{reverse} is similar to but not the same as
  \code{\link[base]{rev}}.
}

\usage{
reverse(x, ...)
}

\arguments{
  \item{x}{
    A vector-like or list-like object.
  }
  \item{...}{
    Additional arguments to be passed to or from methods.
  }
}

\details{
  On a character vector or a \link{Views} object, \code{reverse} reverses
  each element individually, without modifying the top-level order of the
  elements. More precisely, each individual string of a character vector
  is reversed.
}

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

\seealso{
  \link[XVector]{reverse-methods},
  \link{Views-class},
  \link{MaskCollection-class},
  \code{\link{endoapply}},
  \code{\link[base]{rev}}
}

\examples{
## On a character vector:
reverse(c("Hi!", "How are you?"))
rev(c("Hi!", "How are you?"))

## On a Views object:
v <- successiveViews(Rle(c(-0.5, 12.3, 4.88), 4:2), 1:4)
v
reverse(v)
rev(v)

## On a MaskCollection object:
mask1 <- Mask(mask.width=29, start=c(11, 25, 28), width=c(5, 2, 2))
mask2 <- Mask(mask.width=29, start=c(3, 10, 27), width=c(5, 8, 1))
mask3 <- Mask(mask.width=29, start=c(7, 12), width=c(2, 4))
mymasks <- append(append(mask1, mask2), mask3)
reverse(mymasks)
}

\keyword{methods}
\keyword{manip}