Learn R Programming

phytools (version 0.2-20)

add.random: Add tip to all edges in a 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).
tips
a set of tip names for the added tips. If NULL, will name as paste("t",length(tree$tip)+1:n,sep="").
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 te
order
addition order for the new tips.

Value

  • an object of class "phylo".

See Also

allFurcTrees, add.everywhere