as_fe_species_bavrn_state {ForestElementsR} | R Documentation |
Cast Appropriate Objects Into a fe_stand_bavrn_state Species Class Object
Description
If the cast is forward ambiguous, the function terminates with an error. "Forward ambiguous" means that one code in the original object corresponds to more than one codes in the goal coding. If the cast loses information, a warning is raised, but the cast is performed. "Information loss" in this context means that several codes from the orginal coding correspond to only one code in the goal coding.
Usage
as_fe_species_bavrn_state(x)
Arguments
x |
The object to be cast, either a vector of types |
Details
Note that a cast where only one species id from the original coding translates in a goal coding which represents a group of species is NOT considered losing information (i.e. backward ambiguous), because of the 1:1 match in the constellation of the specific cast.
Value
If a meaningful cast is possible, an
fe_species_bavrn_state
object is returned
Examples
as_fe_species_bavrn_state(c(10L, 40L, 40L, 20L)) # integer
as_fe_species_bavrn_state(c(10, 40, 40, 20)) # double
as_fe_species_bavrn_state(c("10", "40", "40", "20")) # character
# cast other fe_species classes
as_fe_species_bavrn_state(
fe_species_tum_wwk_short(as.character(c(1, 1, 1, 3, 3, 5)))
)
as_fe_species_bavrn_state(
fe_species_ger_nfi_2012(as.character(c(20, 20, 10, 30, 30, 100)))
)
# display the casting result in terms of scientific species names
as_fe_species_bavrn_state(c(10L, 40L, 40L, 20L)) |> format("sci")