Skip to contents

Get the number of leaves per taxon. A leaf is a taxon with no subtaxa.

Usage

n_leaves(x)

Arguments

x

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

See also

Other leaf functions: is_leaf(), 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))
n_leaves(x)
#> [1] 3 2 2 0 0 1 1 0