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{...}{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.
38 Only the labelled topologies are compared (i.e. branch lengths are not
42 A logical value, or a two-column matrix.
44 \author{\enc{BenoƮt}{Benoit} \email{b.durand@alfort.AFSSA.FR}}
46 \code{\link[base]{all.equal}} for the generic R function
49 ### maybe the simplest example of two representations
50 ### for the same rooted tree...:
51 t1 <- read.tree(text = "(a:1,b:1);")
52 t2 <- read.tree(text = "(b:1,a:1);")
54 ### ... compare with this:
56 ### one just slightly more complicated...:
57 t3 <- read.tree(text = "((a:1,b:1):1,c:2);")
58 t4 <- read.tree(text = "(c:2,(a:1,b:1):1);")
59 all.equal(t3, t4) # == all.equal.phylo(t3, t4)
60 ### ... here we force the comparison as lists:
61 all.equal.list(t3, t4)
62 t5 <- read.tree(text = "(a:2,(c:1,b:1):1);")
63 ### note that this does NOT return FALSE...:
65 ### ... do this instead:
66 identical(all.equal(t3, t5), TRUE)