matchNodes: Matches nodes between two trees

View source: R/utilities.R

matchNodesR Documentation

Matches nodes between two trees

Description

This function returns a matrix in which the first column contains all of the internal nodes of tr1 and the second column contains the matching nodes from tr2, inasmuch as they can be identified.

Usage

matchNodes(tr1, tr2, method=c("descendants","distances"), ...)
matchLabels(tr1, tr2)

Arguments

tr1

first tree.

tr2

second tree.

method

method to use to match nodes between trees. "descendants" uses the tip species descended from each node; "distances" uses the distances from the nodes to the tips. Any unambiguous shortening of "descendants" or "distances" is also permitted.

...

optional arguments which may or may not be used depending on the value of method. tol is a tolerance value for the difference from exact matching that is allowed for method="distances". corr, which is FALSE by default, indicates whether to match nodes under method="distances" using the correlation (corr=TRUE) or the absolute similarity of distances.

Details

For method="descendants", pairs of matching nodes are defined by sharing all descendant leaves in common.

For method="distances", nodes are considered to matched if the share the same set of distances (or proportional distances, for optional argument corr=TRUE) to all tips.

matchLabels is functionally equivalent but matches node (tip) indices based on identifying matching in the labels only.

Value

A matrix in which the first column contains the nodes of tr1 with the second column containing matching nodes in tr2, with the criterion for matching defined by method.

Author(s)

Liam Revell liam.revell@umb.edu

References

Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.


phytools documentation built on June 22, 2024, 10:39 a.m.