findMRCA: Get the MRCA of a set of taxa

View source: R/utilities.R

findMRCAR Documentation

Get the MRCA of a set of taxa

Description

Finds the most recent common ancestor (MRCA) of a set of tips.

Usage

findMRCA(tree, tips=NULL, type=c("node","height"))

Arguments

tree

a phylogenetic tree as an object of class "phylo".

tips

a vector containing a set of tip labels.

type

either "node" to return the node of the MRCA; or "height" to return the height above the root of the MRCA of tips.

Details

This function returns node number of the most recent common ancestor of a set of taxa.

If tips==NULL and type="node" (the default) it will return the result of a normal function call to mrca.

If tips=NULL and type="height" it will return a matrix equal to that produced by vcv.phylo.

From phytools 0.5-66 forward, findMRCA uses getMRCA in the ape package internally, which results in a big speed-up. Even though the two functions are thus totally redundant I have left findMRCA in the package namespace to ensure backward compatibility.

Value

The node number of the MRCA, or a matrix of node numbers (if tips==NULL) - for type="node"; or the height of the MRCA, or a matrix of heights (if tips==NULL) - for type="height".

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.

See Also

findMRCA, mrca

Examples

data(anoletree)
anc<-findMRCA(anoletree,c("cristatellus","cooki",
  "gundlachi"))
plotTree(anoletree,type="fan",fsize=0.7,lwd=1)
nodelabels(node=anc,frame="circle",pch=21,cex=1.5,
  bg="blue")
legend("topleft","most recent common ancestor\nof Puerto Rican TG anoles",
  pch=21,pt.cex=1.5,pt.bg="blue",cex=0.7,bty="n")
par(mar=c(5.1,4.1,4.1,2.1)) ## reset margin to default

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