x: List of trees, in the format expected by Func().
Func: distance function returning distance between two trees, e.g. path.dist().
FUN.VALUE: Format of output of Func(), to be passed to vapply(). If unspecified, calculated by running Func(x[[1]], x[[1]]).
...: Additional parameters to pass to Func().
Returns
CompareAll() returns a distance matrix of class dist detailing the distance between each pair of trees. Identical trees are assumed to have zero distance.
Details
CompareAll() is not limited to tree comparisons: Func can be any symmetric function.
Examples
# Generate a list of trees to comparelibrary("TreeTools", quietly =TRUE)trees <- list(bal1 = BalancedTree(1:8), pec1 = PectinateTree(1:8), pec2 = PectinateTree(c(4:1,5:8)))# Compare each tree with each other treeCompareAll(trees, NNIDist)# Providing FUN.VALUE yields a modest speed gain:dist <- CompareAll(trees, NNIDist, FUN.VALUE = integer(7))# View distances as a matrixas.matrix(dist$lower)