Describes biological organisms (taxa) occuring in the data and helps resolve them to authority systems. If matches can be made, then the full taxonomic hierarchy of scientific and common names are automatically rendered in the final EML metadata. This enables future users to search on any taxonomic level of interest across data packages in data repositories.

template_taxonomic_coverage(
  path,
  data.path = path,
  taxa.table,
  taxa.col,
  taxa.name.type,
  taxa.authority,
  empty = FALSE,
  write.file = TRUE
)

Arguments

path

(character) Path to the metadata template directory.

data.path

(character) Path to the data directory.

taxa.table

(character) Table with a column listing all unique taxa in the data.

taxa.col

(character) Column name in taxa.table listing all unique taxa.

taxa.name.type

(character) Type of name in taxa.col. Can be: scientific or common.

taxa.authority

(integer) Taxonomic authorities as an ordered numeric vector of ID's decreasing in preference. Supported authorities: 3 = ITIS, 9 = WORMS, 11 = GBIF.

empty

(logical) Whether to write an empty template file.

write.file

(logical; optional) Whether to write the template file.

Value

taxonomic_coverage

Columns:

  • taxa_raw: Taxon name as it occurs in the data. Can be single word or species binomial.

  • name_type: Type of name. Can be "scientific" or "common".

  • name_resolved: Taxon name as found in an authority system.

  • authority_system: Authority system in which the taxa’s name was found. Supported authorities are: "ITIS", "WORMS", "or "GBIF". For unsupported authorities, list the authority home page URL. For unresolved taxa use NA.

  • authority_id: Taxon identifier in the authority system (e.g. 168469).

Details

template_taxonomic_coverage() searches the most preferred taxonomic authority for all unique taxa listed in taxa.col returning the authority name and corresponding taxa identifier for direct matches (no fuzzy searching), then the next most preferred taxonomic authority is search for taxa that have not yet been resolved. This process repeats for subsequently listed authorities. "NA" is returned when an authority match is not made.

make_eml() expands taxa, resolved to supported authorities, into full taxonomic classification. Each level of classification is accompanied by an annotation (listing the authority and authority.id) and common names (only when authority is ITIS or WORMS). Taxa resolved to unsupported authorities, or not resolved at all, will be listed as is defined in the "name_resolved", "authority_system", and "authority_id" columns.

Character encoding of metadata extracted directly from the tables are converted to UTF-8 via enc2utf8().

Examples

if (FALSE) {
# Set working directory
setwd("/Users/me/Documents/data_packages/pkg_260")

# For a table containing taxa, try resolving scientific names to ITIS, and if no matches can be made, then try WORMS
template_taxonomic_coverage(
  path = "./metadata_templates",
  data.path = "./data_objects",
  taxa.table = "decomp.csv",
  taxa.col = "taxa",
  taxa.authority = c(3,9),
  taxa.name.type = "scientific")
  
# For manually resolving taxa to unsupported authorities, use an empty template
template_taxonomic_coverage(
  path = "./metadata_templates",
  empty = TRUE)
  
}