supertaxa {taxa} | R Documentation |
Get supertaxa
Description
Get supertaxa indexes for each taxon or another per-taxon value. Supertaxa are taxa a taxon is contained in.
Usage
supertaxa(
x,
subset = NULL,
max_depth = NULL,
include = FALSE,
value = NULL,
use_na = FALSE,
...
)
Arguments
x |
The object to get supertaxa for, such as a taxonomy object. |
subset |
The subset of the tree to search for roots to that subset. Can be indexes or names. |
max_depth |
The number of levels to traverse. For example, |
include |
If |
value |
Something to return instead of indexes. Must be the same length as the number of taxa. |
use_na |
Add a NA to represent the root of the taxonomy (i.e. no supertaxon) |
... |
Additional arguments. |
See Also
Other taxonomy functions:
internodes()
,
leaves()
,
roots()
,
stems()
,
subtaxa()
Other supertaxa functions:
n_supertaxa()
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 supertaxa (with supertaxa of supertaxa, etc) for each taxon
supertaxa(x)
# Return something other than index
supertaxa(x, value = tax_name(x))
# Include each taxon with its supertaxa
supertaxa(x, value = tax_name(x), include = TRUE)
# Only return data for some taxa (faster than subsetting the whole result)
supertaxa(x, subset = 3)