View source: R/number_of_planning_units.R
number_of_planning_units | R Documentation |
Extract the number of planning units in an object.
number_of_planning_units(x, ...)
## S3 method for class 'ConservationProblem'
number_of_planning_units(x, ...)
## S3 method for class 'OptimizationProblem'
number_of_planning_units(x, ...)
x |
|
... |
not used. |
The planning units for an object corresponds to the number
of entries (e.g., rows, cells) for the planning unit data that
do not have missing (NA
) values for every zone.
For example, a single-layer raster dataset might have 90 cells
and only two of these cells contain non-missing (NA
) values.
As such, this dataset would have two planning units.
An integer
number of planning units.
## Not run:
# load data
sim_pu_raster <- get_sim_pu_raster()
sim_features <- get_sim_features()
# create problem
p <-
problem(sim_pu_raster, sim_features) %>%
add_min_set_objective() %>%
add_relative_targets(0.2) %>%
add_binary_decisions()
# print number of planning units
print(number_of_planning_units(p))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.