ClusterTable {TreeTools} | R Documentation |
Convert phylogenetic tree to ClusterTable
Description
as.ClusterTable()
converts a phylogenetic tree to a ClusterTable
object,
which is an internal representation of its splits suitable for rapid tree
distance calculation (per Day, 1985).
Usage
as.ClusterTable(x, tipLabels = NULL, ...)
## S3 method for class 'phylo'
as.ClusterTable(x, tipLabels = NULL, ...)
## S3 method for class 'list'
as.ClusterTable(x, tipLabels = NULL, ...)
## S3 method for class 'multiPhylo'
as.ClusterTable(x, tipLabels = NULL, ...)
Arguments
x |
Object to convert into |
tipLabels |
Character vector specifying sequence in which to order tip labels. |
... |
Presently unused. |
Details
Each row of a cluster table relates to a clade on a tree rooted on tip 1.
Tips are numbered according to the order in which they are visited in
preorder: i.e., if plotted using plot(x)
, from the top of the page
downwards. A clade containing the tips 2 .. 5 would be denoted by the
entry 2, 5
, in either row 2 or row 5 of the cluster table.
Value
as.ClusterTable()
returns an object of class ClusterTable
.
Author(s)
Martin R. Smith (martin.smith@durham.ac.uk)
References
Day WHE (1985). “Optimal algorithms for comparing trees with labeled leaves.” Journal of Classification, 2(1), 7–28. doi:10.1007/BF01908061.
See Also
S3 methods for ClusterTable
objects.
Examples
tree1 <- ape::read.tree(text = "(A, (B, (C, (D, E))));");
tree2 <- ape::read.tree(text = "(A, (B, (D, (C, E))));");
ct1 <- as.ClusterTable(tree1)
summary(ct1)
as.matrix(ct1)
# Tip label order must match ct1 to allow comparison
ct2 <- as.ClusterTable(tree2, tipLabels = LETTERS[1:5])