find_mrca | R Documentation |
Finds the last common ancestor (node) of a set of two or more descendant tips.
find_mrca(descendant_names, tree)
descendant_names |
A vector of mode character representing the tip names for which an ancestor is sought. |
tree |
The tree as a phylo object. |
Intended for use as an internal function for trim_matrix, but potentially of more general use.
ancestor_node |
The ancestral node number. |
Graeme T. Lloyd graemetlloyd@gmail.com
# Create a simple four-taxon tree:
tree <- ape::read.tree(text = "(A,(B,(C,D)));")
# Plot the tree:
ape::plot.phylo(tree)
# Add nodelabels and show that the most recent common
# ancestor of B, C, and D is node 6:
ape::nodelabels()
# Use find_mrca to show that the most recent common
# ancestor of B, C, and D is node 6:
find_mrca(
descendant_names = c("B", "C", "D"),
tree = tree
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.