View source: R/dyntaxa_api_functions.R
find_descendants | R Documentation |
This helper function recursively finds all descendant taxa of a given taxon ID by traversing the parent-child hierarchy in the provided dataset.
find_descendants(taxon_id, data)
taxon_id |
A character string representing the taxon ID for which to find descendants. |
data |
A data frame containing taxonomic information with columns
|
A tibble containing all descendants of the given taxon, including their
taxonId
, parentNameUsageID
, and any other columns present in the input data
.
# Example data
data <- tibble::tibble(
taxonId = c("1", "2", "3", "4"),
parentNameUsageID = c(NA, "1", "2", "2"),
scientificName = c("Root", "Child1", "Child2", "Grandchild1")
)
# Find descendants of taxon "1"
SHARK4R:::find_descendants("1", data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.