add.random: Add tips at random to the tree

View source: R/add.random.R

add.randomR Documentation

Add tips at random to the tree

Description

This function adds new tips at random to a tree with branch lengths. If no edge lengths are provided, and the tree is ultrametric, then edge lengths are assigned to keep the tree ultrametric. The probability that at new tip is added along any branch is directly proportional to the length of the branch.

Usage

add.random(tree, n=NULL, tips=NULL, edge.length=NULL, order=c("random","input"))

Arguments

tree

an object of class "phylo".

n

a number of tips to add to the tree. If NULL, will use length(tips). If tips is specified, then n is also ignored, regardless of its value.

tips

a set of tip names for the added tips. If NULL, names will be supplied

edge.length

terminal edge length for the added tips. If NULL, and is.ultrametric(tree) ==TRUE, then edge lengths will be assigned to keep the tree ultrametric. Note that if edge lengths are assigned and n>1, then the asssigned terminal edge lengths are not guaranteed as subsequent random tip addition could occur along the new terminal edge.

order

addition order for the new tips.

Details

Note that sometimes the resultant tree plotted with plot.phylo or plotSimmap may display with branches crossing. If so, the tree can be 'untangled' using untangle.

Value

An object of class "phylo".

Author(s)

Liam Revell liam.revell@umb.edu

References

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

See Also

allFurcTrees, add.everywhere


phytools documentation built on Sept. 2, 2022, 1:06 a.m.