Learn R Programming

ForestElementsR (version 2.0.1)

validate_fe_species_bavrn_state_short: Validate an fe_species_bavrn_state_short Object

Description

Regular users will not require this function. Expert users will want to use it in combination with the constructor fe_species_bavrn_state_short. Regular users, please construct fe_species_bavrn_state_short objects with fe_species_bavrn_state_short.

Usage

validate_fe_species_bavrn_state_short(x = character())

Value

Returns x, but this function is mainly called for its side effect which is pointing out any violations of the fe_species_bavrn_state_short object specifications. In case of such violations, the function will terminate with an error.

Arguments

x

An object that is expected to be a valid fe_species_bavrn_state_short object

Examples

Run this code
# Passes validation
spec_ids <- as.character(c(3, 3, 3, 1, 1, 1, 1, 2, 2, 8))
spec_ids <- new_fe_species_bavrn_state_short(spec_ids)
validate_fe_species_bavrn_state_short(spec_ids)

# Validating the following spec_ids throws an error due to
# non-supported species codes
spec_ids <- as.character(c(3, 3, 8712, 1, 1, 1, 349, 2, 2, 8))
spec_ids <- new_fe_species_bavrn_state_short(spec_ids)
try(
  validate_fe_species_bavrn_state_short(spec_ids)
)

Run the code above in your browser using DataLab