Learn R Programming

TreePar (version 3.3)

addroot: addroot: Adds a root edge ancestral to the first branching event.

Description

addroot adds a root edge ancestral to the first branching event.

Usage

addroot(tree,rootlength)

Arguments

tree
Tree of class phylo.
rootlength
Length of the root edge to be added.

Value

res
Tree of class phylo with root edge added to $edge and $edge.length (alternative is to store root edge in $root.edge as done in ape).

Examples

Run this code
set.seed(1)
# Simulate a tree
tree<-sim.bd.taxa(20,1,2,1,complete=FALSE,stochsampling=TRUE)
# add the root edge to the vector tree$edge and tree$edge.length
addroot(tree[[1]],tree[[1]]$root.edge)

Run the code above in your browser using DataLab