Skip to contents

MatchNodes() and MatchEdges() matches nodes or edges in one tree to entries in the second that denote a clade with identical tip labels.

Usage

MatchEdges(x, table, nomatch = NA_integer_)

MatchNodes(x, table, nomatch = NA_integer_, tips = FALSE)

Arguments

x

Tree whose nodes are to be matched.

table

Tree containing nodes to be matched against.

nomatch

Integer value that will be used in place of NA in the case where no match is found.

tips

Logical specifying whether to return matches for tips; unless TRUE, only the matches for internal nodes will be returned.

Value

MatchNodes() returns an integer vector giving, for each internal node of x (and, if tips = TRUE, each tip, listed first), the number of the node in table that subtends the same clade, or nomatch if no node corresponds.

MatchEdges() returns an integer vector giving, for each edge of x, the index of the edge in table that subtends the same clade, or nomatch. Where several nodes or edges of table denote the same clade (because of nodes with a single child), the first is returned.

Details

MatchNodes() treats clades as identical only if they contain exactly the same tips. MatchEdges() disregards tips of table that are absent from x.

References

There are no references for Rd macro \insertAllCites on this help page.

Examples

MatchNodes(BalancedTree(8), RootTree(BalancedTree(8)))
#> [1]  9 10 11 12 13 14 15
MatchEdges(BalancedTree(8), RootTree(BalancedTree(8)))
#>  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14