Learn R Programming

phytools (version 0.2-40)

fastMRCA: Get the MRCA of a pair of tip taxa

Description

This function returns the most recent common ancestor (node number) for a pair of taxa.

Usage

fastMRCA(tree, sp1, sp2)

Arguments

tree
a phylogenetic tree as an object of class "phylo".
sp1
species name.
sp2
species name.

Value

  • The node number of the MRCA.

Details

This function is mostly redundant with findMRCA but for very large trees will be considerably faster. Function uses Ancestors in the phangorn package.

See Also

Ancestors, findMRCA, mrca

Examples

Run this code
tree<-pbtree(n=2000)
	anc<-fastMRCA(tree,"t1","t15")

Run the code above in your browser using DataLab