View source: R/category_layer.R
category_layer | R Documentation |
Convert a terra::rast()
object where each layer corresponds to a different
identifier and values indicate the presence/absence of that category into a
terra::rast()
object containing categorical
identifiers.
category_layer(x)
## S3 method for class 'Raster'
category_layer(x)
## Default S3 method:
category_layer(x)
x |
|
This function is provided to help manage data that encompass
multiple management zones. For instance, this function may be helpful
for interpreting solutions for problems associated with multiple zones that
have binary decisions.
It is essentially a wrapper for terra::which.lyr()
.
A terra::rast()
object.
binary_stack()
.
# create a binary raster stack
x <- terra::rast(list(
terra::rast(matrix(c(1, 0, 0, 1, NA, 0), nrow = 3)),
terra::rast(matrix(c(0, 1, 0, 0, NA, 0), nrow = 3)),
terra::rast(matrix(c(0, 0, 1, 0, NA, 1), nrow = 3))
))
# plot data
plot(x)
# convert to category layer
y <- category_layer(x)
# plot result
## Not run:
plot(y)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.