subset: Subset a "VirtualArray"-class object

subset,VirtualArray-methodR Documentation

Subset a 'VirtualArray'-class object

Description

Extract subsets of an object from a class derived from 'VirtualArray' similarly to a regular array.

Usage

## S4 method for signature 'VirtualArray'
subset(x, i, j, ..., oneDim = FALSE, drop = TRUE)

Arguments

x

VirtualArray-class object.

i

subscript of the first dimension(rows) or vector-like subsetting.

j

subscript of the second dimension (columns).

...

subscript of additional dimensions.

oneDim

logical In case of multidimensional VirtualArrays, setting oneDim to TRUE allows the application of one dimensional subscripts.

drop

logical in case the result of subsetting is a single element, should the \codeVirtualArray wrapper be dropped?

Value

Either the same class as x, or the class that forms the element of the VirtualArray.

Examples

ex <- rastex()
# first 4
subset(ex, i=1:4)
# missing at the end
subset(ex, i=1:12)
# character subscript
subset(ex, i=c("a", "b"))
# logical subscript
subs <- rep(TRUE, length(ex))
subs[1] <- FALSE # remove first
subset(ex, i= subs)
# no drop
subset(ex, i=1, drop=FALSE)

via documentation built on May 31, 2023, 8:31 p.m.

Related to subset in via...