Skip to contents

Function to run the percentile approach

Usage

splnr_climate_percentileApproach(
  featuresDF,
  metricDF,
  targetsDF,
  direction,
  percentile = 35
)

Arguments

featuresDF

feature sfobject which should have a column for cellID

metricDF

climate metric data.frame with 'metric' as the column name of the metric values per planning unit. This should also have a column for the cellID

targetsDF

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

direction

If direction = 1, metric values are from low (least climate-smart) to high (most climate-smart). If direction = -1, metric values are from high (least climate-smart) to low (most climate-smart).

percentile

cut-off threshold for determining whether an area is a climate priority area or not (e.g., lower 35th percentile of warming or upper 65th percentile of acidification). Note that the percentile here is the lower limit of the threshold.

Value

A list with two components: 1. is the data frame passed to prioritizr when creating a conservation problem containing the binary information per planning unit per feature. 2. are the targets for the features in the conservation problem when the CPA approach is used.

Examples

Features <- dat_species_bin %>%
  dplyr::select(-"cellID")

target <- Features %>%
  sf::st_drop_geometry() %>%
  colnames() %>%
  data.frame() %>%
  setNames(c("feature")) %>%
  dplyr::mutate(target = 0.3)

metric_df <- dat_clim


Percentile_Approach <- splnr_climate_percentileApproach(
  featuresDF = dat_species_bin,
  metricDF = metric_df, targetsDF = target, direction = 1
)
#> [1] "Higher values mean more climate-smart areas."
out_sf <- Percentile_Approach$Features
targets <- Percentile_Approach$Targets