Learn R Programming

prioritizr (version 3.0.4)

add_absolute_targets: Add Absolute Targets

Description

Set targets expressed as the actual value of features in the study area that need to be represented in the prioritization. The argument to x is treated the same as for add_relative_targets.

Usage

add_absolute_targets(x, targets, ...) # x=ConservationProblem, targets=numeric

add_absolute_targets(x, targets, ...) # x=ConservationProblem, targets=character

Arguments

targets

numeric targets for features. If all features should have the same target, targets can be a single number. Otherwise, targets should be a numeric vector specifying a target for each feature. Alternatively, if the features in x were specified using a data.frame object, then argument to targets may refer to a column name.

...

not used.

Value

ConservationProblem-class object with the target added to it.

Details

Note that with the exception of the maximum cover problem, targets must be added to a problem or solving will return an error.

Targets are used to specify the minimum amount or proportion of a feature's distribution that needs to be protected. All conservation planning problems require adding targets with the exception of the maximum cover problem (see add_max_cover_objective), which maximizes all features in the solution and therefore does not require targets.

See Also

targets.

Examples

Run this code
# NOT RUN {
# load data
data(sim_pu_raster, sim_features)

# create base problem
p <- problem(sim_pu_raster, sim_features) %>%
     add_min_set_objective() %>%
     add_binary_decisions()

# create problem with targets to secure 3 amounts for each feature
p1 <- p %>% add_absolute_targets(3)

# create problem with varying targets for each feature
targets <- c(1, 2, 3, 2, 1)
p2 <- p %>% add_absolute_targets(targets)
# }
# NOT RUN {
# solve problem
s <- stack(solve(p1), solve(p2))

# plot solution
plot(s, main = c("targets for 3", "varying targets"), axes = FALSE,
     box = FALSE)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab