Learn R Programming

metacoder (version 0.3.7)

is_leaf: Test if taxa are leaves

Description

Test if taxa are leaves in a [taxonomy()] or [taxmap()] object. Leaves are taxa without subtaxa, typically species.


obj$is_leaf()
is_leaf(obj)

Value

A `logical` of length equal to the number of taxa.

Arguments

obj

The [taxonomy()] or [taxmap()] object.

See Also

Other taxonomy data functions: classifications(), id_classifications(), is_branch(), is_internode(), is_root(), is_stem(), map_data(), map_data_(), n_leaves(), n_leaves_1(), n_subtaxa(), n_subtaxa_1(), n_supertaxa(), n_supertaxa_1(), taxon_ids(), taxon_indexes(), taxon_names(), taxon_ranks()

Examples

Run this code
# Test which taxon IDs correspond to leaves
is_leaf(ex_taxmap)

# Filter out leaves
filter_taxa(ex_taxmap, ! is_leaf)

Run the code above in your browser using DataLab