Learn R Programming

TreeTools (version 1.13.0)

match,phylo,phylo-method: Tree matching

Description

match() returns a vector of the positions of (first) matches of trees in its first argument in its second. %in% is a more intuitive interface as a binary operator, which returns a logical vector indicating whether there is a match or not for each tree in its left operand.

Usage

# S4 method for phylo,phylo
match(x, table, nomatch = NA_integer_, incomparables = NULL)

# S4 method for multiPhylo,phylo match(x, table, nomatch = NA_integer_, incomparables = NULL)

# S4 method for phylo,multiPhylo match(x, table, nomatch = NA_integer_, incomparables = NULL)

# S4 method for multiPhylo,multiPhylo match(x, table, nomatch = NA_integer_, incomparables = NULL)

# S4 method for multiPhylo,multiPhylo %in%(x, table)

# S4 method for multiPhylo,phylo %in%(x, table)

# S4 method for phylo,multiPhylo %in%(x, table)

# S4 method for phylo,phylo %in%(x, table)

Value

match() returns an integer vector specifying the position in table that matches each element in x, or nomatch if no match is found.

Arguments

x, table

Object of class phylo or multiPhylo.

nomatch

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

incomparables

Ignored. (Included for consistency with generic.)

See Also

Corresponding base functions are documented in match().

Other utility functions: ClusterTable, ClusterTable-methods, Hamming(), MSTEdges(), SampleOne(), TipTimedTree(), UnshiftTree(), as.multiPhylo(), sapply64(), sort.multiPhylo()

Examples

Run this code
tree1 <- BalancedTree(7)
trees <- c(PectinateTree(7), BalancedTree(7))

match(tree1, trees)

Run the code above in your browser using DataLab