File: slice-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 (80 lines) | stat: -rw-r--r-- 2,085 bytes parent folder | download | duplicates (6)
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
74
75
76
77
78
79
80
\name{slice-methods}

\alias{slice-methods}

\alias{slice,integer-method}
\alias{slice,XInteger-method}
\alias{slice,numeric-method}
\alias{slice,XDouble-method}


\title{Slice an XInteger or XDouble object}

\description{
  The \code{\link[IRanges]{slice}} methods for \link{XInteger} and
  \link{XDouble} objects create views corresponding to the indices where
  the data are within the specified bounds. The views are returned in a
  \link{XIntegerViews} or \link{XDoubleViews} object.
}

\usage{
\S4method{slice}{integer}(x, lower=-.Machine$integer.max, upper=.Machine$integer.max)

\S4method{slice}{XInteger}(x, lower=-.Machine$integer.max, upper=.Machine$integer.max)

\S4method{slice}{numeric}(x, lower=-Inf, upper=Inf,
      includeLower=TRUE, includeUpper=TRUE, rangesOnly=FALSE)

\S4method{slice}{XDouble}(x, lower=-.Machine$double.xmax, upper=.Machine$double.xmax,
      includeLower=TRUE, includeUpper=TRUE, rangesOnly=FALSE)
}

\arguments{
  \item{x}{
    An \link{XInteger} or \link{XDouble} object. Alternatively, it can also
    be an integer or numeric vector.
  }
  \item{lower, upper}{
    The lower and upper bounds for the slice.
  }
  \item{includeLower, includeUpper}{
    Logical indicating whether or not the specified boundary is open or closed.
  }
  \item{rangesOnly}{
    A logical indicating whether or not to drop the original data from the
    output.
  }
}

\value{
  An \link{XIntegerViews} or \link{XDoubleViews} object
  if \code{rangesOnly=FALSE}.

  An \link[IRanges]{IRanges} object if \code{rangesOnly=TRUE}.
}

\author{P. Aboyoun}

\seealso{
  \itemize{
    \item \link{view-summarization-methods} for summarizing the views
          returned by \code{slice}.

    \item \link[IRanges]{slice-methods} in the IRanges package
          for more \code{slice} methods.

    \item The \link{XInteger}, \link{XIntegerViews}, \link{XDouble}, and
          \link{XDoubleViews} classes.
  }
}

\examples{
vec <- as.integer(c(19, 5, 0, 8, 5))
slice(vec, lower=5, upper=8)

set.seed(0)
vec <- sample(24)
slice(vec, lower=4, upper=16)
}

\keyword{methods}