slice-methods {XVector} | R Documentation |
The slice
methods for XInteger and
XDouble objects create views corresponding to the indices where
the data are within the specified bounds. The views are returned in a
XIntegerViews or XDoubleViews object.
## S4 method for signature 'integer'
slice(x, lower=-.Machine$integer.max, upper=.Machine$integer.max)
## S4 method for signature 'XInteger'
slice(x, lower=-.Machine$integer.max, upper=.Machine$integer.max)
## S4 method for signature 'numeric'
slice(x, lower=-Inf, upper=Inf,
includeLower=TRUE, includeUpper=TRUE, rangesOnly=FALSE)
## S4 method for signature 'XDouble'
slice(x, lower=-.Machine$double.xmax, upper=.Machine$double.xmax,
includeLower=TRUE, includeUpper=TRUE, rangesOnly=FALSE)
x |
An XInteger or XDouble object. Alternatively, it can also be an integer or numeric vector. |
lower , upper |
The lower and upper bounds for the slice. |
includeLower , includeUpper |
Logical indicating whether or not the specified boundary is open or closed. |
rangesOnly |
A logical indicating whether or not to drop the original data from the output. |
An XIntegerViews or XDoubleViews object
if rangesOnly=FALSE
.
An IRanges object if rangesOnly=TRUE
.
P. Aboyoun
view-summarization-methods for summarizing the views
returned by slice
.
slice-methods in the IRanges package
for more slice
methods.
The XInteger, XIntegerViews, XDouble, and XDoubleViews classes.
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)