number_of_zones {prioritizr} | R Documentation |
Number of zones
Description
Extract the number of zones in an object.
Usage
number_of_zones(x, ...)
## S3 method for class 'ConservationProblem'
number_of_zones(x, ...)
## S3 method for class 'OptimizationProblem'
number_of_zones(x, ...)
## S3 method for class 'ZonesRaster'
number_of_zones(x, ...)
## S3 method for class 'ZonesSpatRaster'
number_of_zones(x, ...)
## S3 method for class 'ZonesCharacter'
number_of_zones(x, ...)
Arguments
x |
|
... |
not used. |
Value
An integer
number of zones.
Examples
## Not run:
# load data
sim_zones_pu_raster <- get_sim_zones_pu_raster()
sim_zones_features <- get_sim_zones_features()
# print number of zones in a Zones object
print(number_of_zones(sim_zones_features))
# create problem with multiple zones
p <-
problem(sim_zones_pu_raster, sim_zones_features) %>%
add_min_set_objective() %>%
add_relative_targets(matrix(0.2, ncol = 3, nrow = 5)) %>%
add_binary_decisions()
# print number of zones in the problem
print(number_of_zones(p))
## End(Not run)
[Package prioritizr version 8.0.4 Index]