Skip to contents

Single bracket '[' refers to indices and names within the 'VirtualArray'-class object. Use double brackets to extract layers based on their names (in the @stack).

Usage

# S4 method for VirtualArray,ANY,ANY
[(x, i, j, ..., drop = TRUE)

Arguments

x

An object from a VirtualArray-derived class.

i

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

j

subscript of the second dimension (columns).

...

subscript of additional dimensions.

drop

logical in case the result of subsetting is a single element, should the VirtualArray-derived wrapper be dropped?

Value

An object from either the same class as x or the class of its elements.

Examples

ex <- rastex()
# numeric subsetting
firstThree <- ex[1:3]
# character subsetting
second <- ex["d"]
# logical subsetting
subscript <- rep(FALSE, length(ex))
subscript[2] <- TRUE
second2 <- ex[subscript]
data(paleocoastlines)
present<- paleocoastlines["0", ]
allMargin <- paleocoastlines[, "margin"]