| strat_breaks {sgsR} | R Documentation |
Breaks stratification
Description
Stratify metrics raster using user defined breaks
Usage
strat_breaks(
mraster,
breaks,
map = FALSE,
plot = FALSE,
details = FALSE,
filename = NULL,
overwrite = FALSE
)
Arguments
mraster |
Spatraster. Raster to stratify. Layers in |
breaks |
Numeric. Vector of breakpoints for each layer of |
map |
Logical. Map individual stratified layers to a combined stratification. Will output a multi-layer
|
plot |
Logical. Plots output strata raster and visualized strata with boundary dividers. |
details |
Logical. If |
filename |
Character. Path to write stratified raster to disc. |
overwrite |
Logical. Specify whether |
Value
Returns an output stratification spatRaster or a list when details = TRUE.
When a list is returned:
-
rasteris a stratifiedspatRasterbased on quantiles. Ifstack = TRUEwill be the number of layers ofmrasterplus the final output -
breaksis a list output ofbreaks -
plotis aggplothistogram object showing distribution(s) and break point(s).
Author(s)
Tristan R.H. Goodbody
See Also
Other stratify functions:
strat_kmeans(),
strat_map(),
strat_poly(),
strat_quantiles()
Examples
#--- Load raster ---#
r <- system.file("extdata", "mraster.tif", package = "sgsR")
mr <- terra::rast(r)
#--- create vector breaks ---#
br.zq90 <- c(3, 5, 11, 18)
br.pz2 <- c(20, 40, 60, 80)
strat_breaks(
mraster = mr$zq90,
breaks = br.zq90
)
strat_breaks(
mraster = mr[[1:2]],
breaks = list(br.zq90, br.pz2),
details = TRUE
)