VirtualArray-double-bracket-method: Indexing to extract the elements of a "VirtualArray"-derived...

[[,VirtualArray,ANY,ANY-methodR Documentation

Indexing to extract the elements of a 'VirtualArray'-derived class object.

Description

Double bracket '[[' refers to elements'/layers' name in the @stack of the 'VirtualArray'-derived object. Use single brackets to extract elements based on their position in the 'VirtualArray'.

Usage

## S4 method for signature 'VirtualArray,ANY,ANY'
x[[i, drop = TRUE]]

Arguments

x

VirtualArray

i

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

drop

logical should the VirtualArray be dropped and the element be reduced to the element class?

Value

A VirtualArray-derived class object, or an object of the class that makes up the VirtualArray

Examples

data(exemplar)
# finds a layer
exemplar[["sample1"]]
# returns a stack
exemplar[[c("sample1", "sample2")]]
# replaces a layervalues, but not the attributes of the layer
exemplar2 <- exemplar
exemplar2[["sample1"]] <- exemplar2[["sample2"]]
# compare every value in the they are all the same
exemplar2[["sample1"]]$x == exemplar2[["sample2"]]$x

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