add_worms_taxonomy: Retrieve and Organize WoRMS Taxonomy for SHARK Aphia IDs

View source: R/worms_api_functions.R

add_worms_taxonomyR Documentation

Retrieve and Organize WoRMS Taxonomy for SHARK Aphia IDs

Description

This function collects WoRMS (World Register of Marine Species) taxonomy information for a given set of Aphia IDs. The data is organized into a full taxonomic table that can be joined with data downloaded from SHARK.

Usage

add_worms_taxonomy(aphia_id, scientific_name = NULL, verbose = TRUE)

Arguments

aphia_id

A numeric vector containing Aphia IDs for which WoRMS taxonomy needs to be updated.

scientific_name

A character vector of scientific names. If provided, Aphia IDs will be retrieved from the scientific names. The length of scientific_name must match the length of aphia_id. Defaults to NULL, in which case the function will only add taxonomy to the provided Aphia IDs.

verbose

A logical indicating whether to print progress messages. Default is TRUE.

Value

A data frame containing current WoRMS taxonomy information.

See Also

get_shark_data, update_dyntaxa_taxonomy, https://www.marinespecies.org/rest/, https://CRAN.R-project.org/package=worrms

Examples

## Not run: 
# Update WoRMS taxonomy for a set of Aphia IDs
updated_taxonomy <- add_worms_taxonomy(c(149619, 149122, 11))
print(updated_taxonomy)

# Update WoRMS with an unknown Aphia ID and scientific names
with_names <- add_worms_taxonomy(c(149619, 149122, 11, NA),
                                 c("Cerataulina pelagica",
                                   "Chaetoceros didymus",
                                   "Ciliophora",
                                   "Dinophysis"))
print(with_names)

## End(Not run)


sharksmhi/SHARK4R documentation built on Jan. 9, 2025, 5:15 p.m.