make_taxonomicCoverage: Make taxonomicCoverage EML node

View source: R/make_taxonomicCoverage.R

make_taxonomicCoverageR Documentation

Make taxonomicCoverage EML node

Description

Make taxonomicCoverage EML node

Usage

make_taxonomicCoverage(
  taxa.clean,
  authority = NA,
  authority.id = NA,
  rank = NA,
  path,
  write.file = TRUE
)

Arguments

taxa.clean

(character) Taxa names as they appear in your dataset

authority

(character) Authorities taxa.clean have been resolved to. Supported authorities include: "ITIS", "WORMS", "GBIF". For unsupported authorities, list the home page URL. For unresolved taxa use NA. If only one authority is provided, function will use that authority for all entries. If more than one authority, e.g. four, but fewer than the length of taxa.clean, is provided, function will only expand into full taxonomic classification for the first names, up to the number of authorities provided (e.g. the first four in taxa.clean); the rest of the names will not be expanded.

authority.id

(character) ID of taxa.clean within the authority, otherwise NA

rank

(character) Rank (e.g. "Genus", "Species") of taxa.clean, otherwise NA. This is useful when taxa.clean can't be resolved to an authority and the rank must be manually defined.

path

(character) Path of the directory to which taxonomicCoverage.xml will be written. Can also be the path of the directory containing taxa_map.csv, if using as inputs to this function.

write.file

(logical) Whether taxonomicCoverage.xml should be written to file. Default is TRUE.

Details

This function uses get_classification() to expand 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 taxa.clean, authority, and authority.id arguments.

Value

emld list

The taxonomicClassification EML node for use in constructing EML metadata with the EML R library.

taxonomicCoverage.xml

If write.file = TRUE.

Note

The name of this function is a bit misleading. The return value is actually a list of taxonomicClassification nodes, which occur immediately below taxonomicCoverage (i.e. ../taxonomicCoverage/taxonomicClassification).

Examples

## Not run: 

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

# For taxa resolved to a supported authority
taxcov <- make_taxonomicCoverage(
  taxa.clean = c("Oncorhynchus tshawytscha", "Oncorhynchus nerka"),
  authority = c("WORMS", "WORMS"),
  authority.id = c("158075", "254569"),
  path = ".")

# For taxa resolved to an unsupported authority
taxcov <- make_taxonomicCoverage(
  taxa.clean = c("Taxon-1", "Taxon-2"),
  authority = c("https://some-authority.org", "https://some-authority.org"),
  authority.id = c("123", "456"),
  path = ".")

# For taxa not resolved to an authority
taxcov <- make_taxonomicCoverage(
  taxa.clean = c("Taxon-1", "Taxon-2"),
  path = ".")


## End(Not run)


EDIorg/taxonomyCleanr documentation built on April 9, 2023, 2:43 a.m.