Learn R Programming

prioritizr (version 5.0.3)

ferrier_score: Ferrier irreplaceability score

Description

Calculate irreplaceability scores for planning units selected in a solution using the method outlined in Ferrier et al. (2000). Here, scores are calculated separately for each feature within each planning unit. Additionally, a total irreplaceability score is also calculated as the sum of the irreplaceability scores for each planning unit. Note that this function only works for problems with a minimum set objective and a single zone. It will throw an error for other types of problems. Please note that the mathematical formulation for computing these scores needs to be double checked by an expert, and so this functionality should be considered experimental at this point in time.

Usage

ferrier_score(x, solution)

# S4 method for ConservationProblem,numeric ferrier_score(x, solution)

# S4 method for ConservationProblem,matrix ferrier_score(x, solution)

# S4 method for ConservationProblem,data.frame ferrier_score(x, solution)

# S4 method for ConservationProblem,Spatial ferrier_score(x, solution)

# S4 method for ConservationProblem,Raster ferrier_score(x, solution)

Arguments

x

problem() (i.e. '>ConservationProblem) object.

solution

numeric, matrix, data.frame, '>Raster, or '>Spatial object. See the Details section for more information.

Value

A matrix, tibble::tibble(), '>RasterLayer, or '>Spatial object containing the scores for each planning unit selected in the solution.

Details

The argument to solution must correspond to the planning unit data in the argument to x in terms of data representation, dimensionality, and spatial attributes (if applicable). This means that if the planning unit data in x is a numeric vector then the argument to solution must be a numeric vector with the same number of elements, if the planning unit data in x is a '>RasterLayer then the argument to solution must also be a '>RasterLayer with the same number of rows and columns and the same resolution, extent, and coordinate reference system, if the planning unit data in x is a '>Spatial object then the argument to solution must also be a '>Spatial object and have the same number of spatial features (e.g. polygons) and have the same coordinate reference system, if the planning units in x are a data.frame then the argument to solution must also be a data.frame with each column correspond to a different zone and each row correspond to a different planning unit, and values correspond to the allocations (e.g. values of zero or one). Furthermore, solutions must have planning unit statuses set to missing (NA) values for planning units that have missing (NA) cost data. If an argument is supplied to solution where this is not the case, then an error will be thrown.

References

Ferrier S, Pressey RL, and Barrett TW (2000) A new predictor of the irreplaceability of areas for achieving a conservation goal, its application to real-world planning, and a research agenda for further refinement. Biological Conservation, 93: 303--325.

See Also

irreplaceability.

Examples

Run this code
# NOT RUN {
# seed seed for reproducibility
set.seed(600)

# load data
data(sim_pu_raster, sim_features)

# create minimal problem with binary decisions
p1 <- problem(sim_pu_raster, sim_features) %>%
      add_min_set_objective() %>%
      add_relative_targets(0.1) %>%
      add_binary_decisions() %>%
      add_default_solver(gap = 0, verbose = FALSE)
# }
# NOT RUN {
# solve problem
s1 <- solve(p1)

# print solution
print(s1)

# plot solution
plot(s1, main = "solution", axes = FALSE, box = FALSE)

# calculate irreplaceability scores using Ferrier et al. 2000 method
fs1 <- ferrier_score(p1, s1)

# print irreplaceability scores,
# each planning unit has an irreplaceability score for each feature
# (as indicated by the column names) and each planning unit also
# has an overall total irreplaceability score (in the "total" column)
print(fs1)

# plot total irreplaceability scores
plot(fs1, axes = FALSE, box = FALSE)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab