View source: R/env_div_survey_scheme.R
env_div_survey_scheme | R Documentation |
Generate a survey scheme by maximizing the diversity of environmental conditions that are surveyed.
env_div_survey_scheme(
site_data,
cost_column,
survey_budget,
env_vars_columns,
method = "mahalanobis",
locked_in_column = NULL,
locked_out_column = NULL,
exclude_locked_out = FALSE,
solver = "auto",
verbose = FALSE
)
site_data |
|
cost_column |
|
survey_budget |
|
env_vars_columns |
|
method |
|
locked_in_column |
|
locked_out_column |
|
exclude_locked_out |
|
solver |
|
verbose |
|
The integer programming formulation of the environmental diversity reserve selection problem (Faith & Walker 1996) is used to generate survey schemes.
A matrix
of logical
(TRUE
/ FALSE
)
values indicating if a site is selected in a scheme or not. Columns
correspond to sites, and rows correspond to different schemes.
This function can use the Rsymphony package and the Gurobi optimization software to generate survey schemes. Although the Rsymphony package is easier to install because it is freely available on the The Comprehensive R Archive Network (CRAN), it is strongly recommended to install the Gurobi optimization software and the gurobi R package because it can generate survey schemes much faster. Note that special academic licenses are available at no cost. Installation instructions are available online for Linux, Windows, and Mac OS operating systems.
Faith DP & Walker PA (1996) Environmental diversity: on the best-possible use of surrogate data for assessing the relative biodiversity of sets of areas. Biodiversity & Conservation, 5, 399–415.
# set seed for reproducibility
set.seed(123)
# simulate data
x <- sf::st_as_sf(
tibble::tibble(x = rnorm(4), y = rnorm(4),
v1 = c(0.1, 0.2, 0.3, 10), # environmental axis 1
v2 = c(0.1, 0.2, 0.3, 10), # environmental axis 2
cost = rep(1, 4)),
coords = c("x", "y"))
# plot the sites' environmental conditions
plot(x[, c("v1", "v2")], pch = 16, cex = 3)
# generate scheme with a budget of 2
s <- env_div_survey_scheme(x, "cost", 2, c("v1", "v2"), "mahalanobis")
# print scheme
print(s)
# plot scheme
x$scheme <- c(s)
plot(x[, "scheme"], pch = 16, cex = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.