Indexing to extract subsets of a codeRasterArray or SpatialArray object
Single bracket '['
refers to indices and names within the RasterArray
. Use double brackets to extract layers based on their names (in the stack).
## S4 method for signature 'XArray,ANY,ANY' x[i, j, ..., drop = TRUE]
x |
|
i |
subscript of the first dimension(rows) or vector-like subsetting. |
j |
subscript of the second dimension (columns). |
... |
subscript of additional dimensions. |
drop |
|
A RasterLayer
, RasterArray
, Spatial*
or SpatialArray
class object.
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"]
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.