Skip to contents

Prepare data to plot how well targets are met

Usage

splnr_get_featureRep(
  soln,
  pDat,
  targetsDF = NA,
  climsmart = FALSE,
  climsmartApproach = 0,
  solnCol = "solution_1"
)

Arguments

soln

The prioritizr solution

pDat

The prioritizr problem

targetsDF

data.framewith list of features under "feature" column and their corresponding targets under "target" column

climsmart

logical denoting whether spatial planning was done climate-smart (and targets have to be calculated differently)

climsmartApproach

either 0,1,2 or 3 depending on the climate-smart approach used (0 = None; 1 = Climate Priority Area; 2 = Feature; 3 = Percentile).

solnCol

Name of the column with the solution

Value

tbl_df dataframe

Examples

pDat <- prioritizr::problem(dat_species_bin %>% dplyr::mutate(Cost = runif(n = dim(.)[[1]])),
  features = c("Spp1", "Spp2", "Spp3"),
  cost_column = "Cost"
) %>%
  prioritizr::add_min_set_objective() %>%
  prioritizr::add_relative_targets(0.3) %>%
  prioritizr::add_binary_decisions() %>%
  prioritizr::add_default_solver(verbose = FALSE)

soln <- pDat %>%
  prioritizr::solve.ConservationProblem()

df <- splnr_get_featureRep(
  soln = soln,
  pDat = pDat
)