Return the "branch" taxa for a taxonomy() or taxmap() object. A branch is anything that is not a root, stem, or leaf. Its the interior of the tree after the first split starting from the roots. Can also be used to get the branches of a subset of taxa.

obj$branches(subset = NULL, value = "taxon_indexes")
branches(obj, subset = NULL, value = "taxon_indexes")



The taxonomy() or taxmap() object containing taxon information to be queried.


Taxon IDs, TRUE/FALSE vector, or taxon indexes used to subset the tree prior to determining branches. Default: All taxa in obj will be used. Any variable name that appears in all_names() can be used as if it was a vector on its own. Note that branches are determined after the filtering, so a given taxon might be a branch on the unfiltered tree, but not a branch on the filtered tree.


What data to return. This is usually the name of column in a table in obj$data. Any result of all_names() can be used, but it usually only makes sense to use data that corresponds to taxa 1:1, such as taxon_ranks(). By default, taxon indexes are returned.



See also

Other taxonomy indexing functions: internodes(), leaves(), roots(), stems(), subtaxa(), supertaxa()


# Return indexes of branch taxa branches(ex_taxmap)
#> d e f h i j k l #> 3 4 5 7 8 9 10 11
# Return indexes for a subset of taxa branches(ex_taxmap, subset = 2:17)
#> g h k #> 6 7 10
branches(ex_taxmap, subset = n_obs > 1)
#> named integer(0)
# Return something besides taxon indexes branches(ex_taxmap, value = "taxon_names")
#> d e f h i #> "Felidae" "Notoryctidae" "Hominidae" "Panthera" "Felis" #> j k l #> "Notoryctes" "homo" "Solanum"