get_dyntaxa_parent_ids: Get parent taxon IDs for specified taxon IDs from Dyntaxa
Description
This function queries the SLU Artdatabanken API (Dyntaxa) to retrieve parent taxon IDs for the specified taxon IDs.
It constructs a request with the provided taxon IDs, sends the request to the SLU Artdatabanken API, and
processes the response to return a list of parent taxon IDs.
A list containing parent taxon IDs corresponding to the specified taxon IDs.
Arguments
taxon_ids
A vector of numeric taxon IDs for which parent taxon IDs are requested.
subscription_key
A Dyntaxa API subscription key. By default, the key
is read from the environment variable DYNTAXA_KEY.
You can provide the key in three ways:
Directly as a parameter:
get_dyntaxa_parent_ids(238366, subscription_key = "your_key_here").
Temporarily for the session:
Sys.setenv(DYNTAXA_KEY = "your_key_here").
After this, you do not need to pass subscription_key to the function.
Permanently across sessions by adding it to your ~/.Renviron file.
Use usethis::edit_r_environ() to open the file, then add:
DYNTAXA_KEY=your_key_here.
After this, you do not need to pass subscription_key to the function.
verbose
Logical. Default is TRUE.
Details
A valid Dyntaxa API subscription key is required.
You can request a free key for the "Taxonomy" service from the ArtDatabanken API portal:
https://api-portal.artdatabanken.se/
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.
if (FALSE) {
# Get parent taxon IDs for taxon IDs 238366 and 1010380parent_ids <- get_dyntaxa_parent_ids(c(238366, 1010380), "your_subscription_key")
print(parent_ids)
}