leaves: Get leaves

View source: R/taxonomy.R

leavesR Documentation

Get leaves

Description

Get leaves indexes for each taxon or another per-taxon value. Leaves are taxa with no subtaxa.

Usage

leaves(x, value = NULL, ...)

Arguments

x

The object to get leaves for, such as a taxonomy object

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(), roots(), stems(), subtaxa(), supertaxa()

Other leaf functions: is_leaf(), n_leaves()

Examples

x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
                'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
              supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
leaves(x)
leaves(x, value = tax_name(x))


ropensci/taxa documentation built on Feb. 22, 2024, 5:08 p.m.