Learn R Programming

prioritizr (version 4.1.5)

category_layer: Category layer

Description

Convert a RasterStack-class object where each layer corresponds to a different identifier and values indicate the presence/absence of that category into a RasterLayer-class object containing categorical identifiers.

Usage

category_layer(x)

Arguments

x

Raster-class object containing a multiple layers. Note that pixels must be 0, 1 or NA values.

Value

RasterLayer-class object.

Details

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.

See Also

binary_stack.

Examples

Run this code
# NOT RUN {
# create a binary raster stack
x <- stack(raster(matrix(c(1, 0, 0, 1, NA, 0), nrow = 3)),
           raster(matrix(c(0, 1, 0, 0, NA, 0), nrow = 3)),
           raster(matrix(c(0, 0, 1, 0, NA, 1), nrow = 3)))

# convert to binary stack
y <- category_layer(x)

# plot categorical raster and binary stack representation
# }
# NOT RUN {
plot(stack(x, y), main = c("x[[1]]", "x[[2]]", "x[[3]]", "y"), nr = 1)
# }

Run the code above in your browser using DataLab