Learn R Programming

TreeTools (version 1.12.0)

ClusterTable: 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 phylo as.ClusterTable(x, tipLabels = NULL, ...)

# S3 method for list as.ClusterTable(x, tipLabels = NULL, ...)

# S3 method for multiPhylo as.ClusterTable(x, tipLabels = NULL, ...)

Value

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

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.

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

Day1985TreeTools

See Also

S3 methods for ClusterTable objects.

Examples

Run this code
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])

Run the code above in your browser using DataLab