]> git.donarmstrong.com Git - ape.git/blob - man/all.equal.phylo.Rd
9242c9f6450a093e4b16784ad78d781bf30064c9
[ape.git] / man / all.equal.phylo.Rd
1 \encoding{latin1}
2 \name{all.equal.phylo}
3 \alias{all.equal.phylo}
4 \title{Global Comparison of two Phylogenies}
5 \usage{
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,
9                    scale = NULL, \dots)
10 }
11 \arguments{
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
21     lengths.}
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.}
25 }
26 \description{
27   This function makes a global comparison of two phylogenetic trees.
28 }
29 \details{
30   This function is meant to be an adaptation of the generic function
31   \code{all.equal} for the comparison of phylogenetic trees.
32
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.
37 }
38 \note{
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:
42
43   \url{https://stat.ethz.ch/pipermail/r-sig-phylo/2011-August/001562.html}
44 }
45 \value{
46   A logical value, or a two-column matrix.
47 }
48 \author{\enc{BenoĆ®t}{Benoit} \email{b.durand@alfort.AFSSA.FR}}
49 \seealso{
50   \code{\link[base]{all.equal}} for the generic \R function
51 }
52 \examples{
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);")
57 all.equal(t1, t2)
58 ### ... compare with this:
59 identical(t1, t2)
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...:
68 all.equal(t3, t5)
69 ### ... do this instead:
70 identical(all.equal(t3, t5), TRUE)
71 }
72 \keyword{manip}