subtaxa {taxa} | R Documentation |
Get subtaxa
Description
Get subtaxa indexes for each taxon or another per-taxon value. Subtaxa are taxa contained within a taxon.
Usage
subtaxa(x, subset = NULL, max_depth = NULL, include = FALSE, value = NULL, ...)
Arguments
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. |
See Also
Other taxonomy functions:
internodes()
,
leaves()
,
roots()
,
stems()
,
supertaxa()
Other subtaxa functions:
n_subtaxa()
Examples
# 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)
[Package taxa version 0.4.3 Index]