calculate_pcomp {sgsR} | R Documentation |
Raster principal components
Description
Calculate and rasterize principal components from a metric raster
Usage
calculate_pcomp(
mraster,
nComp,
center = TRUE,
scale = TRUE,
maxcells = Inf,
plot = FALSE,
details = FALSE,
filename = NULL,
overwrite = FALSE,
...
)
Arguments
mraster |
spatRaster. ALS metrics raster. |
nComp |
Numeric. Value indicating number of principal components to be rasterized. |
center |
Logical. Value indicating whether the variables should be shifted to be zero centered. |
scale |
Logical. Value indicating whether the variables should be scaled to have unit variance. |
maxcells |
Numeric. Maximum number of samples to use to generate principal components.
For objects that are too large to feed into |
plot |
Logical. Plots output strata raster with samples. |
details |
Logical. If |
filename |
Character. Path to write output samples. |
overwrite |
Logical. Choice to overwrite existing |
... |
Additional arguments to be passed to |
Value
Output raster with specified number of principal components as layers.
Author(s)
Tristan R.H. Goodbody
See Also
Other calculate functions:
calculate_allocation()
,
calculate_allocation_existing()
,
calculate_coobs()
,
calculate_distance()
,
calculate_pop()
,
calculate_representation()
,
calculate_sampsize()
Examples
#--- Load raster ---#
r <- system.file("extdata", "mraster.tif", package = "sgsR")
mr <- terra::rast(r)
calculate_pcomp(
mraster = mr,
nComp = 2
)
pcomp <- calculate_pcomp(
mraster = mr,
nComp = 3,
details = TRUE
)
#--- Display principal component details ---#
# pcomp$pca
#--- Display importance of components ---#
# summary(pcomp$pca)