R/nodeTimes.R

Defines functions nodeTimes

# nodeTimes 
#
# Finds internal and external of a tree (ultrametric or non-ultrametric)

nodeTimes <- function(phy) {
	if(methods::is(phy$edge.length)[1] == "NULL") stop("no tree edge lengths")
    phy <- stats::reorder(phy)
    depBranches <- node.depth.edgelength(phy)
    all <- cbind(depBranches[phy$edge[, 1]], depBranches[phy$edge[ ,2]])
    return(max(depBranches) - all)
}
PuttickMacroevolution/MCMCtreeR documentation built on Nov. 24, 2019, 5:22 a.m.