Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Subtree

Extract a subtree


Description

Subtree() safely extracts a clade from a phylogenetic tree.

Usage

Subtree(tree, node)

Arguments

tree

A tree of class phylo, with internal numbering in cladewise order (use Preorder(tree) or (slower) Cladewise(tree)) .

node

The number of the node at the base of the clade to be extracted.

Details

Modified from the ape function extract.clade, which sometimes behaves erratically. Unlike extract.clade, this function supports the extraction of 'clades' that constitute a single tip.

Value

Subtree() returns a tree of class phylo that represents a clade extracted from the original tree.

Author(s)

Martin R. Smith (martin.smith@durham.ac.uk)

See Also

Examples

tree <- Preorder(BalancedTree(8))
plot(tree)
ape::nodelabels()
ape::nodelabels(13, 13, bg='yellow')

plot(Subtree(tree, 13))

TreeTools

Create, Modify and Analyse Phylogenetic Trees

v1.4.4
GPL (>= 3)
Authors
Martin R. Smith [aut, cre, cph] (<https://orcid.org/0000-0001-5660-1727>), Emmanuel Paradis [cph] (<https://orcid.org/0000-0003-3092-2199>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.