Skip to contents

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 ClusterTable: perhaps a tree of class phylo.

tipLabels

Character vector specifying sequence in which to order tip labels.

...

Presently unused.

Value

as.ClusterTable() returns an object of class ClusterTable.

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.

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)
#> ClusterTable on 5 leaves:
#>  12345
#>  **...
#>  ***..
#>  ****.
#>  *****
#>  1: E  2: D  3: C  4: B  5: A 
as.matrix(ct1)
#>      [,1] [,2]
#> [1,]    0    0
#> [2,]    1    2
#> [3,]    1    3
#> [4,]    1    4
#> [5,]    1    5

# Tip label order must match ct1 to allow comparison
ct2 <- as.ClusterTable(tree2, tipLabels = LETTERS[1:5])