Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

binary_stack

Binary stack


Description

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

Usage

binary_stack(x)

Arguments

x

Raster object containing a single layer.

Details

This function is provided to help manage data that encompass multiple management zones. For instance, this function may be helpful for preparing raster data for add_locked_in_constraints() and add_locked_out_constraints() since they require binary RasterStack objects as input arguments.

Value

RasterStack object.

See Also

Examples

# create raster with categorical identifers
x <- raster(matrix(c(1, 2, 3, 1, NA, 1), nrow = 3))

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

# plot categorical raster and binary stack representation
## Not run: 
plot(stack(x, y), main = c("x", "y[[1]]", "y[[2]]", "y[[3]]"), nr = 1)

## End(Not run)

prioritizr

Systematic Conservation Prioritization in R

v7.0.1
GPL-3
Authors
Jeffrey O Hanson [aut] (<https://orcid.org/0000-0002-4716-6134>), Richard Schuster [aut, cre] (<https://orcid.org/0000-0003-3191-7869>), Nina Morrell [aut], Matthew Strimas-Mackey [aut] (<https://orcid.org/0000-0001-8929-7776>), Matthew E Watts [aut], Peter Arcese [aut] (<https://orcid.org/0000-0002-8097-482X>), Joseph Bennett [aut] (<https://orcid.org/0000-0002-3901-9513>), Hugh P Possingham [aut] (<https://orcid.org/0000-0001-7755-996X>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.