Parses species codes in input data and matches them with the BETY species ID.

match_species_id(
  input_codes,
  format_name = "custom",
  bety = NULL,
  translation_table = NULL,
  ...
)

Arguments

input_codes

Character vector of species codes

format_name

Species code format name (see details)

bety

BETY connection object

translation_table

Data frame with custom translation table (see details).

...

additional arguments, currently ignored

Value

data.frame containing the following columns:

input_code

Character provided as input

bety_species_id

Big integer species ID, unique and specific to BETY

genus

Genus part of Latin name, from BETY

species

Species part of Latin name, from BETY

Details

format_name can be one of the following:

usda

USDA Plants database symbol (e.g. QURU, TSCA)

fia

FIA species code

latin_name

Scientific name, as "Genus species"; must match exactly and unambiguously to scientificname field in BETY

custom

A data frame matching BETY IDs (column name bety_species_id) to input codes (column name input_code). This data frame must be passed via the translation_table argument.

Author

Alexey Shiklomanov <ashiklom@bu.edu>, Istem Fer

Examples

if (FALSE) { # \dontrun{
con <- PEcAn.DB::db.open(list(
  driver = "Postgres",
  dbname = 'bety',
  user = 'bety',
  password = 'bety',
  host = 'localhost')
)
input_codes <- c('ACRU', 'PIMA', 'TSCA')
format_name <- 'usda'
match_species_id(input_codes = input_codes,
                 format_name = format_name,
                 bety = con)
} # }