Learn R Programming

treescape (version 1.0.0)

treeDist: Metric function

Description

Comparison of two trees using the Kendall Colijn metric

Usage

treeDist(tree.a, tree.b, lambda = 0, return.lambda.function = FALSE)

Arguments

Value

The vector with the metric values or a function that produces the vector given a value of lambda.

Examples

Run this code
## generate random trees
tree.a <- rtree(6)
tree.b <- rtree(6)
treeDist(tree.a,tree.b) # lambda=0
treeDist(tree.a,tree.b,1)  # lambda=1
dist.func <- treeDist(tree.a,tree.b,return.lambda.function=TRUE) # distance as a function of lambda
dist.func(0) # evaluate at lambda=0. Equivalent to treeDist(tree.a,tree.b).
## We can see how the distance changes when moving from focusing on topology to length:
plot(sapply(seq(0,1,length.out=100), function(x) dist.func(x)), type="l",ylab="",xlab="")

Run the code above in your browser using DataLab