Subset a RasterArray or SpatialArray object
Extract subsets of RasterArray
or SpatialArray
class object similarly to a regular array.
## S4 method for signature 'XArray' subset(x, i, j, ..., oneDim = FALSE, 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. |
oneDim |
|
drop |
|
A RasterLayer
, RasterArray
, Spatial*
or SpatialArray
class object.
data(dems) # first 4 subset(dems, i=1:4) # missing at the end subset(dems, i=1:12) # character subscript subset(dems, i=c("5", "25")) # logical subscript subs <- rep(TRUE, length(dems)) subs[1] <- FALSE # remove first subset(dems, i= subs) # no drop subset(dems, i=1, drop=FALSE) data(coasts) subset(coasts, i=2, j=1:2)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.