c,GRaster-method | R Documentation |
GRaster
s can be "stacked" using this function, effectively creating a multi-layered raster. This is different from creating a 3-dimensional raster, though such an effect can be emulated using stacking. GVector
s can be combined into a single vector. Stacks can only be created when:
All objects are the same class (either all GRaster
s or all GVector
s).
All objects have the same coordinate reference system (see crs()).
Horizontal extents are the same (see ext()
).
Horizontal dimensions are the same (see res()
).
The topology (2- or 3-dimensional) must be the same. If 3D, then all rasters must have the same number of depths and vertical extents (see topology()
).
Data tables associated with GVector
s will be combined if each vector has a table and if each table has the same columns and data types. Otherwise, the data table will be combined using merge()
.
## S4 method for signature 'GRaster'
c(x, ...)
x |
A |
... |
One or more |
A GRaster
.
add<-, terra::c()
, add<-
if (grassStarted()) {
# Setup
madForest2000 <- fastData("madForest2000")
madForest2014 <- fastData("madForest2014")
# Convert SpatRasters to GRasters:
forest2000 <- fast(madForest2000)
forest2014 <- fast(madForest2014)
# Combine:
forest <- c(forest2000, forest2014)
forest
nlyr(forest)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.