number_of_features {prioritizr}R Documentation

Number of features

Description

Extract the number of features in an object.

Usage

number_of_features(x, ...)

## S3 method for class 'ConservationProblem'
number_of_features(x, ...)

## S3 method for class 'OptimizationProblem'
number_of_features(x, ...)

## S3 method for class 'ZonesSpatRaster'
number_of_features(x, ...)

## S3 method for class 'ZonesRaster'
number_of_features(x, ...)

## S3 method for class 'ZonesCharacter'
number_of_features(x, ...)

Arguments

x

A problem(), optimization_problem(), or zones() object.

...

not used.

Value

An integer number of features.

Examples

## 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 features
print(number_of_features(p))

## End(Not run)

[Package prioritizr version 8.0.4 Index]