View source: R/all.equal.phylo.R
all.equal.phylo | R Documentation |
This function makes a global comparison of two phylogenetic trees.
## S3 method for class 'phylo'
all.equal(target, current, use.edge.length = TRUE,
use.tip.label = TRUE, index.return = FALSE,
tolerance = .Machine$double.eps ^ 0.5,
scale = NULL, ...)
target |
an object of class |
current |
an object of class |
use.edge.length |
if |
use.tip.label |
if |
index.return |
if |
tolerance |
the numeric tolerance used to compare the branch lengths. |
scale |
a positive number, comparison of branch lengths is made after scaling (i.e., dividing) them by this number. |
... |
further arguments passed to or from other methods. |
This function is meant to be an adaptation of the generic function
all.equal
for the comparison of phylogenetic trees.
A single phylogenetic tree may have several representations in the Newick
format and in the "phylo"
class of objects used in ‘ape’. One
aim of the present function is to be able to identify whether two
objects of class "phylo"
represent the same phylogeny.
A logical value, or a two-column matrix.
The algorithm used here does not work correctly for the comparison of
topologies (i.e., ignoring tip labels) of unrooted trees. This also
affects unique.multiPhylo
which calls the present function. See:
https://www.mail-archive.com/r-sig-phylo@r-project.org/msg01445.html.
Benoît Durand b.durand@alfort.AFSSA.FR
all.equal
for the generic R function, comparePhylo
### maybe the simplest example of two representations
### for the same rooted tree...:
t1 <- read.tree(text = "(a:1,b:1);")
t2 <- read.tree(text = "(b:1,a:1);")
all.equal(t1, t2)
### ... compare with this:
identical(t1, t2)
### one just slightly more complicated...:
t3 <- read.tree(text = "((a:1,b:1):1,c:2);")
t4 <- read.tree(text = "(c:2,(a:1,b:1):1);")
all.equal(t3, t4) # == all.equal.phylo(t3, t4)
### ... here we force the comparison as lists:
all.equal.list(t3, t4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.