Convert TRY database data to PEcAn format for meta-analysis
Source:R/format_try.R
format_try_for_ma.RdThis function converts trait data from the external TRY database into the tabular format required by the PEcAn meta-analysis module.
Usage
format_try_for_ma(
try_data,
trait_map = try_trait_mapping(),
species_map = NULL
)Arguments
- try_data
A data frame containing data from the TRY database.
- trait_map
A named character vector for mapping TRY TraitName to PEcAn vname. Names should be TRY TraitName and values should be PEcAn vname. Defaults to `try_trait_mapping()`.
- species_map
An optional named vector mapping TRY `SpeciesName` to PEcAn BETY `specie_id`. If provided, this is used to assign `specie_id` instead of using the raw `AccSpeciesID`. If omitted, the returning data will include a `species_name` column to help users map PFTs later.
Details
The resulting data frame is in the format returned by the PEcAn database (`PEcAn.DB::query.traits()`). To be used in `pecan.ma()`, **it must first be run through the `jagify()` function** to ensure all missing values and columns are appropriately processed, as the meta-analysis model requires data converted into specific distributions and error formats. `jagify` will drop unused TRY-specific columns and compute the final `obs.prec` values.