Subtree: Extract a subtree

View source: R/phylo.R

SubtreeR Documentation

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

Other tree manipulation: AddTip(), CollapseNode(), ConsensusWithout(), DropTip(), EnforceOutgroup(), ImposeConstraint(), KeptPaths(), KeptVerts(), LeafLabelInterchange(), MakeTreeBinary(), Renumber(), RenumberTips(), RenumberTree(), RootTree(), SortTree(), TipTimedTree(), TrivialTree

Examples

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

plot(Subtree(tree, 13))


TreeTools documentation built on June 22, 2024, 9:27 a.m.