Learn R Programming

phytools (version 0.5-38)

reroot: Re-root a tree along an edge

Description

This function re-roots a phylogenetic tree at an arbitrary position along an edge.

Usage

reroot(tree, node.number, position=NULL, interactive=FALSE, ...)

Arguments

tree
a phylogenetic tree in "phylo" format.
node.number
number of the node descending from the target branch in tree$edge - this can also be a tip in which case the node number is the index number of the tip in tree$tip.label.
position
position along the target edge at which to re-root the tree. If not supplied, then the tree will be re-rooted at the node or tip.
interactive
logical value indicating whether to use interactive mode (defaults to interactive=FALSE).
...
arguments to be passed to plotTree for interactive=TRUE only.

Value

A phylogenetic tree in "phylo" format.

Details

This function had an error for rootings along edges descended from the root node for phytools<=0.2-47. this="" should="" be="" fixed="" in="" the="" present="" version.="" now="" uses="" paste.tree, root, and splitTree internally. Earlier versions also had an error related to node labels. This should be fixed in phytools>=0.4-47.

References

Paradis, E., J. Claude, and K. Strimmer (2004) APE: Analyses of phylogenetics and evolution in R language. Bioinformatics, 20, 289-290.

Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.

See Also

splitTree, paste.tree, root