construct_dyntaxa_missing_table: Construct Dyntaxa Taxonomy Table From Individual API

View source: R/dyntaxa_api_functions.R

construct_dyntaxa_missing_tableR Documentation

Construct Dyntaxa Taxonomy Table From Individual API

Description

This internal function constructs a taxonomy table by individually querying the SLU Artdatabanken API (Dyntaxa) using a list of parent taxon IDs. It fetches taxonomy information for the provided taxon IDs and organizes them into a hierarchical structure. The function is capable of filtering based on recommended (accepted) names, handling genus-related children, and formatting the results for SHARK output.

Usage

construct_dyntaxa_missing_table(
  parent_ids,
  subscription_key,
  shark_output = TRUE,
  recommended_only = TRUE,
  add_genus_children = FALSE,
  drop_morphotypes = TRUE,
  add_hierarchy = FALSE,
  verbose = TRUE
)

Arguments

parent_ids

A list or vector of parent taxon IDs for which taxonomy information is requested. These IDs must be valid according to the Dyntaxa API and can be a combination of single or multiple IDs.

subscription_key

A character string containing the subscription key for accessing the SLU Artdatabanken API. You must register at Artdatabanken to obtain a key.

shark_output

Logical. If TRUE, the function will return columns formatted to match the SHARK data submission format. If FALSE, it will return a broader set of taxonomy information. Defaults to TRUE.

recommended_only

Logical. If TRUE, only recommended (accepted) names will be returned. Defaults to TRUE.

add_genus_children

Logical. If TRUE, the function will include all valid genus-level children for each parent taxon. Defaults to FALSE.

drop_morphotypes

Logical. If TRUE, taxa with the rank of "MorphoType" will be excluded from the output to simplify the taxonomy structure. Defaults to TRUE.

add_hierarchy

Logical. If TRUE, the hierarchical relationship of taxa (from parent to child) will be included in the output. Defaults to FALSE.

verbose

Logical. If TRUE, a progress bar will be displayed during execution. Defaults to TRUE.

Details

Note: Please review the API conditions and register for access before using the API. Data collected through the API is stored at SLU Artdatabanken. Please also note that the authors of SHARK4R are not affiliated with SLU Artdatabanken.

Value

A data frame with taxonomy information, including taxon IDs, parent IDs, ranks, names, and other details. The data frame may also include hierarchical information depending on the parameters set.

Examples

## Not run: 
# Construct Dyntaxa taxonomy table for taxon IDs 238366 and 1010380
parent_ids <- get_dyntaxa_parent_ids(c(238366, 1010380), "your_subscription_key")
taxonomy_table <- SHARK4R:::construct_dyntaxa_missing_table(parent_ids, "your_subscription_key")
print(taxonomy_table)

## End(Not run)


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