MRCA: MRCA

Description Usage Arguments Details Value Examples

Description

Most Recent Common Ancestor (MRCA) of 2 or more nodes.

Usage

1
2
3
4
5
6
7
MRCA(phy, ...)

## S4 method for signature 'phylo4'
MRCA(phy, ...)

## S4 method for signature 'phylo'
MRCA(phy, ...)

Arguments

phy

a phylogenetic tree in phylo4, phylo4d or phylo format.

...

a vector of nodes

Details

Given some nodes (i.e., tips and/or internal), this function returns the node corresponding to the most recent common ancestor.

If phy is a phylo4 or phylo4d object, the nodes can contain both numeric or character values that will be used by getNode to retrieve the correct node. However, if phy is a phylo object, the nodes must be a numeric vector.

With phylo4 and phylo4d objects, if a single node is provided, it will be returned.

Value

the node corresponding to the most recent common ancestor

Examples

1
2
3
4
5
6
  data(geospiza)
  MRCA(geospiza, 1, 5)
  MRCA(geospiza, "fortis", 11)
  MRCA(geospiza, 2, 4, "fusca", 3)
  geo <- as(geospiza, "phylo")
  MRCA(geo, c(1,5))

Example output

N21 
 21 
N18 
 18 
N17 
 17 
Warning messages:
1: In asMethod(object) : losing data while coercing phylo4d to phylo
2: In asMethod(object) : trees with unknown order may be unsafe in ape
[1] 21

phylobase documentation built on March 26, 2020, 7:44 p.m.