align_data_to_data_pft.Rd
align_data_to_data_pft
align_data_to_data_pft(con, observation_one, observation_two, custom_table = NULL, format_one, format_two, subset_is_ok = FALSE)
con | database connection |
---|---|
observation_one | a vector of plant functional types, or species |
observation_two | another vector of plant functional types, or species |
custom_table | a table that either maps two pft's to one another 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 alignment when species lists aren't identical. set to FALSE by default. |
list
containing the following columns:
$original
Will spit back out original vectors pre-alignment
$aligned$aligned_by_observation_one
Where possible, will return a vector of observation_one pft's/species in the order of observation_two
species
Where possible, will return a vector of observation_two's pft's/species in the order of observation_one
$bety_species_id
Where possible, will return the bety_species_id's for one or both observations
$bety_species_intersection
Where possible, will return the intersection of two aligned lists of species. subset_is_ok must be set to TRUE.
Aligns vectors of Plant Fucntional Typed and species. 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_species_codes if possible, and an aligned output. Because some alignement is order-sensitive, alignment based on observation_one and observation_two are both provided.
# NOT RUN { observation_one<-c("AMCA3","AMCA3","AMCA3","AMCA3") observation_two<-c("a", "b", "a", "a") 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) format_one<-"species_USDA_symbol" format_two<-"plant_functional_type" aligned <- align_data_to_data_pft( con = con, observation_one = observation_one, observation_two = observation_two, format_one = format_one, format_two = format_two, custom_table = table) # }