## 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, \dots)
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.
all.equal
for the generic Rfunction### 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)
t5 <- read.tree(text = "(a:2,(c:1,b:1):1);")
### note that this does NOT return FALSE...:
all.equal(t3, t5)
### ... do this instead:
identical(all.equal(t3, t5), TRUE)
Run the code above in your browser using DataLab