validate_fe_species_ger_nfi_2012: Validate an _fe_species_ger_nfi_2012_ Object

View source: R/fe_species_ger_nfi_2012.R

validate_fe_species_ger_nfi_2012R Documentation

Validate an fe_species_ger_nfi_2012 Object

Description

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

Usage

validate_fe_species_ger_nfi_2012(x = character())

Arguments

x

An object that is expected to be a correct fe_species_ger_nfi_2012 object

Value

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

Examples

# Passes validation
spec_ids <- as.character(c(30, 30, 30, 10, 10, 10, 10, 20, 20, 290))
spec_ids <- new_fe_species_ger_nfi_2012(spec_ids)
validate_fe_species_ger_nfi_2012(spec_ids)

# Validating the following spec_ids throws an error due to
# non-supported species codes
spec_ids <- as.character(c(30, 30, 542, 10, 10, 10, 1234, 20, 20, 290))
spec_ids <- new_fe_species_ger_nfi_2012(spec_ids)
try(
  validate_fe_species_ger_nfi_2012(spec_ids)
)


ForestElementsR documentation built on April 3, 2025, 7:47 p.m.