subtaxa | R Documentation |
Get subtaxa indexes for each taxon or another per-taxon value. Subtaxa are taxa contained within a taxon.
subtaxa(x, subset = NULL, max_depth = NULL, include = FALSE, value = NULL, ...)
x |
The object to get subtaxa for, such as a taxonomy object. |
subset |
The subset of the tree to search. Can be indexes or names. |
max_depth |
The number of ranks to traverse. For example, |
include |
If |
value |
Something to return instead of indexes. Must be the same length as the number of taxa. |
... |
Additional arguments. |
Other taxonomy functions:
internodes()
,
leaves()
,
roots()
,
stems()
,
supertaxa()
Other subtaxa functions:
n_subtaxa()
# Generate example data
x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
# The indexes of all subtaxa (with subtaxa of subtaxa, etc) for each taxon
subtaxa(x)
# The indexes of immediate subtaxa (without subtaxa of subtaxa, etc) for each taxon
subtaxa(x, max_depth = 1)
# Return something other than index
subtaxa(x, value = tax_name(x))
# Include each taxon with its subtaxa
subtaxa(x, value = tax_name(x), include = TRUE)
# Only return data for some taxa (faster than subsetting the whole result)
subtaxa(x, subset = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.