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

DropTip

Drop tips from tree


Description

DropTip() removes specified tips from a phylogenetic tree, collapsing incident branches.

Usage

DropTip(tree, tip)

## S3 method for class 'phylo'
DropTip(tree, tip)

## S3 method for class 'multiPhylo'
DropTip(tree, tip)

Arguments

tree

A tree of class phylo.

tip

Character vector specifying labels of leaves in tree to be dropped, or integer vector specifying the indices of leaves to be dropped. Specifying the index of an internal node will drop all descendants of that node.

Details

This function is more robust than ape::drop.tip() as it does not require any particular internal node numbering schema. It is not presently as fast, though it is ripe for optimization; if you are finding this function is a rate-limiting step, please get in touch and I'll prioritise writing a faster implementation.

Value

DropTip() returns a tree of class phylo, in Preorder, with the requested leaves removed.

Author(s)

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

See Also

Examples

tree <- BalancedTree(8)
plot(tree)
plot(DropTip(tree, c('t4', 't5')))

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.