sub-XArray-ANY-ANY-method: Indexing to extract subsets of a codeRasterArray or...

Description Usage Arguments Value Examples

Description

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

Usage

1
2
## S4 method for signature 'XArray,ANY,ANY'
x[i, j, ..., drop = TRUE]

Arguments

x

RasterArray or SpatialArray object.

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 RasterArray or SpatialArray wrapper be dropped and the element be reduced to a single RasterLayer or Spatial*?

Value

A RasterLayer, RasterArray, Spatial* or SpatialArray class object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(dems)
# numeric subsetting
firstThree <- dems[1:3]
# character subsetting
second <- dems["10"]
# logical subsetting
subscript <- rep(FALSE, length(dems))
subscript[2] <- TRUE
second2 <- dems[subscript]
data(coasts)
present<- coasts["0", ]
allMargin <- coasts[, "margin"]

chronosphere documentation built on April 19, 2021, 1:07 a.m.