Indexing to extract RasterLayers of a RasterArray or Spatial* of a SpatialArray object
Double bracket '[['
refers to layers' name in the RasterStack
of the RasterArray
or the SpatialStack
of the SpatialArray
. Use single brackets to extract elements based on their position in the RasterArray
or SpatialArray
## S4 method for signature 'XArray,ANY,ANY' x[[i, drop = TRUE]]
x |
|
i |
subscript of the first dimension(rows) or vector-like subsetting. |
drop |
|
A RasterLayer
or RasterArray
class object.
data(dems) # finds a layer dems[["dem_30"]] # returns a stack dems[[c("dem_0", "dem_15")]] # replaces a layervalues, but not the attributes of the layer dem2 <- dems dem2[["dem_0"]] <- dem2[["dem_5"]] # compare every value in the 0 and 5 ma maps, they are all the same mean(values(dem2[["dem_0"]]==dem2[["dem_5"]]))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.