Creates an empty plant parameter table for medfate, populating taxonomic information if desired.

initSpParams(
  sp_names,
  SpParamsDefinition,
  accepted_names = NULL,
  fill_taxonomy = TRUE,
  complete_rows = TRUE,
  sort = TRUE,
  verbose = FALSE
)

Arguments

sp_names

Vector of plant names, either taxon names or arbitrary species group names

SpParamsDefinition

Data frame of species parameter definition from package medfate

accepted_names

Vector of accepted taxon names of the same length of `sp_names`

fill_taxonomy

Boolean flag to indicate that taxonomic information should be filled (retrieved from GBIF using package 'taxize')

complete_rows

Boolean flag to indicate that extra rows should be added for cited species/genera (if `fill_taxonomy = TRUE`)

sort

Boolean flag to force sorting in ascending order by `Name`

verbose

A boolean flag to indicate extra console output

Value

A data frame with empty species parameter values suitable for medfate simulations

Details

Taxonomic information is retrieved using functions in package taxize and GBIF as data source.

See also

Author

Miquel De Cáceres Ainsa, EMF-CREAF

Examples

if (FALSE) {
# Load species parameter definition from medfate
data(SpParamsDefinition)

# Simple example with two species
sp_names <- c("Salvia rosmarinifolia", "Pinus contorta")
initSpParams(sp_names, SpParamsDefinition)

# Simple example with three species using synonyms and subspecies
sp_names <- c("Rosmarinus officinalis", "Pinus contorta", "Quercus ilex subsp. ilex")
accepted_names <- c("Salvia rosmarinifolia", "Pinus contorta", "Quercus ilex subsp. ilex")
initSpParams(sp_names, SpParamsDefinition, accepted_names)

# Initialisation with Spanish NFI species mapping
data(NFI_SP_mapping)
# Remove species that are not mapped
NFI_SP_mapping_red <- NFI_SP_mapping[!is.na(NFI_SP_mapping$acceptedName),]
# Names in SpParams will be the original NFI names but accepted names
# will be used for parameter estimation
SpParams <- initSpParams(sp_names = NFI_SP_mapping_red$NFIName[1:20],
                        SpParamsDefinition = SpParamsDefinition,
                        accepted_names = NFI_SP_mapping_red$acceptedName[1:20],
                        verbose = TRUE)

}