as_fe_species_tum_wwk_long: Cast Appropriate Objects Into a *fe_species_tum_wwk_long*...

View source: R/fe_species_tum_wwk_long.R

as_fe_species_tum_wwk_longR Documentation

Cast Appropriate Objects Into a fe_species_tum_wwk_long 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_tum_wwk_long(x)

Arguments

x

The object to be cast, either a vector of types integer, double, or character or an object of one of the supported fe_species classes

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_ger_nfi_2012 object is returned

Examples

as_fe_species_tum_wwk_long(c(10L, 41L, 41L, 31L)) # integer
as_fe_species_tum_wwk_long(c(10, 41, 41, 31)) # double
as_fe_species_tum_wwk_long(c("10", "41", "41", "31")) # character

# cast other fe_species classes
as_fe_species_tum_wwk_long(
  fe_species_tum_wwk_short(as.character(c(1, 1, 1, 3, 3, 5)))
)
as_fe_species_tum_wwk_long(
  fe_species_bavrn_state(as.character(c(20, 20, 10, 30, 30, 60)))
)

# display the casting result in terms of scientific species names
as_fe_species_tum_wwk_long(c(10L, 41L, 41L, 31L)) |> format("sci")


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