Align vectors of Plant Functional Type and species.
Usage
align_pft(
con,
observation_one,
observation_two,
custom_table = NULL,
format_one,
format_two,
subset_is_ok = FALSE,
comparison_type = "data_to_data",
...
)Arguments
- con
database connection
- observation_one
a vector of plant fucntional types, or species
- observation_two
anouther vector of plant fucntional types, or species
- custom_table
a table that either maps two pft's to one anouther or maps custom species codes to bety id codes. In the second case, must be passable to match_species_id.
- format_one
The output of query.format.vars() of observation one of the form output$vars$bety_names
- format_two
The output of query.format.vars() of observation two of the form output$vars$bety_names
- subset_is_ok
When aligning two species lists, this allows for alignement when species lists aren't identical. set to FALSE by default.
- comparison_type
one of "data_to_model", "data_to_data", or "model_to_model"
- ...
other arguments, currently ignored
Value
list containing the following columns:
$originalWill spit back out original vectors pre-alignment
$aligned$aligned_by_observation_oneWhere possible, will return a vector of observation_one pft's/species in the order of observation_two
speciesWhere possible, will return a vector of observation_two's pft's/species in the order of observation_one
$bety_species_idWhere possible, will return the bety_species_id's for one or both observations
Details
Can align: - two vectors of plant fucntional types (pft's) if a custom map is provided - a list of species (usda, fia, or latin_name format) to a plant fucntional type - a list of species in a custom format, with a table mapping it to bety_species_id's
Will return a list of what was originally provided, bety_speceis_codes if possible, and an aligned output. Becuase some alignement is order-sensitive, alignment based on observation_one and observation_two are both provided.
comparison_type can be one of the following:
data_to_dataWill align lists of pfts and species. Must be assosiated with inputs.
data_to_modelNot yet implemented
model_to_modelNot yet implemented
Examples
if (FALSE) { # \dontrun{
con <- db.open(list(host = "postgres", user = "bety", password = "carya"))
#------------ A species to PFT alignment -----------
observation_one <- c("AMCA3","AMCA3","AMCA3","AMCA3")
observation_two <- c("a", "b", "a", "a")
format_one <- "species_USDA_symbol"
format_two <- "plant_functional_type"
table <- list()
table$plant_functional_type_one <- c("AMCA3","AMCA3","ARHY", "ARHY")
table$plant_functional_type_two <- c('a','a','b', 'b') # PFT groupings
table <- as.data.frame(table)
aligned <- align_pft(
con = con,
observation_one = observation_one, observation_two = observation_two,
custom_table = table,
format_one = format_one, format_two = format_two)
} # }