3 \alias{all.equal.phylo}
4 \title{Global Comparison of two Phylogenies}
6 \method{all.equal}{phylo}(target, current, use.edge.length = TRUE,
7 use.tip.label = TRUE, index.return = FALSE,
8 tolerance = .Machine$double.eps ^ 0.5,
12 \item{target}{an object of class \code{"phylo"}.}
13 \item{current}{an object of class \code{"phylo"}.}
14 \item{use.edge.length}{if \code{FALSE} only the topologies are
15 compared; the default is \code{TRUE}.}
16 \item{use.tip.label}{if \code{FALSE} the unlabelled trees are
17 compared; the default is \code{TRUE}.}
18 \item{index.return}{if \code{TRUE} the function returns a two-column
19 matrix giving the correspondence between the nodes of both trees.}
20 \item{tolerance}{the numeric tolerance used to compare the branch
22 \item{scale}{a positive number, comparison of branch lengths is made
23 after scaling (i.e., dividing) them by this number.}
24 \item{\dots}{further arguments passed to or from other methods.}
27 This function makes a global comparison of two phylogenetic trees.
30 This function is meant to be an adaptation of the generic function
31 \code{all.equal} for the comparison of phylogenetic trees.
33 A single phylogenetic tree may have several representations in the Newick
34 format and in the \code{"phylo"} class of objects used in `ape'. One
35 aim of the present function is to be able to identify whether two
36 objects of class \code{"phylo"} represent the same phylogeny.
39 The algorithm used here does not work correctly for the comparison of
40 topologies (i.e., ignoring tip labels) of unrooted trees. This also
41 affects \code{\link{unique.multiPhylo}} which calls the present function. See:
43 \url{https://stat.ethz.ch/pipermail/r-sig-phylo/2011-August/001562.html}
46 A logical value, or a two-column matrix.
48 \author{\enc{BenoƮt}{Benoit} \email{b.durand@alfort.AFSSA.FR}}
50 \code{\link[base]{all.equal}} for the generic \R function
53 ### maybe the simplest example of two representations
54 ### for the same rooted tree...:
55 t1 <- read.tree(text = "(a:1,b:1);")
56 t2 <- read.tree(text = "(b:1,a:1);")
58 ### ... compare with this:
60 ### one just slightly more complicated...:
61 t3 <- read.tree(text = "((a:1,b:1):1,c:2);")
62 t4 <- read.tree(text = "(c:2,(a:1,b:1):1);")
63 all.equal(t3, t4) # == all.equal.phylo(t3, t4)
64 ### ... here we force the comparison as lists:
65 all.equal.list(t3, t4)
66 t5 <- read.tree(text = "(a:2,(c:1,b:1):1);")
67 ### note that this does NOT return FALSE...:
69 ### ... do this instead:
70 identical(all.equal(t3, t5), TRUE)