View source: R/feasible_survey_schemes.R
feasible_survey_schemes | R Documentation |
Generate a matrix
representing all possible different
survey schemes given survey costs and a fixed budget.
feasible_survey_schemes( site_data, cost_column, survey_budget, locked_in_column = NULL, locked_out_column = NULL, verbose = FALSE )
site_data |
|
cost_column |
|
survey_budget |
|
locked_in_column |
|
locked_out_column |
|
verbose |
|
A matrix
where each row corresponds to a different
survey scheme, and each column corresponds to a different planning unit.
Cell values are logical
(TRUE
/ FALSE
) indicating
if a given site is selected in a given survey scheme.
Please note that this function requires the Gurobi optimization software (https://www.gurobi.com/) and the gurobi R package if different sites have different survey costs. Installation instruction are available online for for Linux, Windows, and Mac OS.
## Not run: # set seed for reproducibility set.seed(123) # simulate data x <- sf::st_as_sf(tibble::tibble(x = rnorm(4), y = rnorm(4), cost = c(100, 200, 0.2, 1)), coords = c("x", "y")) # print data print(x) # plot site locations plot(st_geometry(x), pch = 16, cex = 3) # generate all feasible schemes given a budget of 4 s <- feasible_survey_schemes(x, "cost", survey_budget = 4) # print schemes print(s) # plot first scheme x$scheme_1 <- s[1, ] plot(x[, "scheme_1"], pch = 16, cex = 3) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.