Learn R Programming

caper (version 0.4)

clade.matrix: Create a clade matrix from a phylogeny

Description

Takes a phylogeny in the 'ape' package format and converts it into a binary matrix showing which tips (matrix columns) subtend from each node in the phylogeny (matrix rows). This is a useful format for quickly calculating branch length information for subsets of the phylogeny.

Usage

clade.matrix(phy)

Arguments

phy
A object of class 'phylo'

Value

  • A list of class 'clade.matrix' containing the following components:
  • clade.matrixA binary m x n matrix, where m is the total number of nodes in the phylogeny and n is the number of tips. An element is 1 if tip $n_i$ subtends from a node $m_j$.
  • edge.lengthA numeric vector of length m showing the edge length leading to each node in the phylogeny and named with the node number.
  • tip.labelA character vector of length n giving the labels assigned to the tips of the phylogeny.
  • edgeThe edge matrix from the original phylogeny.

Details

The clade matrix shows the tips from a phylogeny that subtend from each internal and external node. Each tip is represented as column showing the nodes of which it is a member and hence each row shows the tips that are members of a given node. Dropping columns gives a quick and easy way to find out which edges are retained in a particular subset of the tree and this structure is used for quickly calculating branch lengths calculations or clade statistics.

Examples

Run this code
data(perissodactyla)
clade.matrix(perissodactyla.tree)

Run the code above in your browser using DataLab