mosaic_classify | R Documentation |
This function classifies a given raster mosaic based on user-defined breaks. It provides an option to calculate the frequency and area of each class, as well as plot the classified mosaic.
mosaic_classify(mosaic, breaks, frequency = TRUE, plot = TRUE)
mosaic |
A |
breaks |
A numeric vector specifying the breakpoints for classification. |
frequency |
Logical. If |
plot |
Logical. If |
A list with two elements:
classified
: A SpatRaster
object containing the classified mosaic.
class_freq
: A data frame containing class frequencies, areas (ha), and percentages (if frequency = TRUE
).
if(interactive()){
library(pliman)
library(terra)
# Create an example raster
r <- terra::rast(matrix(runif(100, min = 0, max = 1), nrow=10, ncol=10))
# Classify the raster
result <- mosaic_classify(r, breaks = c(0.3, 0.6))
# View results
result$classified
result$class_freq
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.