Learn R Programming

BAT (version 2.11.0)

tree.addTip: Add tips to a tree.

Description

Add tips (i.e., new taxa) to an existing tree using an edge of a given length.

Usage

tree.addTip(tree, tip, newTip, len, minDist = 0)

Value

A phylo object.

Arguments

tree

A phylo object.

tip

Vector of names of all sister species of new taxon to add.

newTip

A string with the name of taxon to add.

len

A numeric with the length of edge to add.

minDist

The minimum distance from the sister species to the new species.

Details

If len is smaller than the length of edges connecting all sister species to the new species, the minDist will be applied to the tree at a point above the connecting edge.

Examples

Run this code
par(mfrow = c(1,3))
tree = sim.tree(5, 100)
tree$tip.label = c("Sp1", "Sp2", "Sp3", "Sp4", "Sp5")
plot(tree)
ape::edgelabels(round(tree$edge.length, 3))

newTree = tree.addTip(tree, c("Sp1"), "Sp6", 0.1)
plot(newTree)
ape::edgelabels(round(newTree$edge.length, 3))

newTree = tree.addTip(tree, c("Sp1", "Sp2"), "Sp7", 0.2, 0.01)
plot(newTree)
ape::edgelabels(round(newTree$edge.length, 3))

Run the code above in your browser using DataLab