3 \alias{as.matching.phylo}
4 \alias{as.phylo.matching}
5 \title{Conversion Between Phylo and Matching Objects}
7 These functions convert objects between the classes \code{"phylo"} and
12 \method{as.matching}{phylo}(x, labels = TRUE, ...)
13 \method{as.phylo}{matching}(x, ...)
16 \item{x}{an object to convert as an object of class \code{"matching"}
17 or of class \code{"phylo"}.}
18 \item{labels}{a logical specifying whether the tip and node labels
19 should be included in the returned matching.}
20 \item{\dots}{further arguments to be passed to or from other methods.}
23 A matching is a representation where each tip and each node are given
24 a number, and sibling groups are grouped in a ``matching pair'' (see
25 Diaconis and Holmes 1998, for details). This coding system can be used
26 only for binary (fully dichotomous) trees.
28 Diaconis and Holmes (1998) gave some conventions to insure that a
29 given tree has a unique representation as a matching. I have tried to
30 follow them in the present functions.
33 \code{as.matching} returns an object of class \code{"matching"} with
34 the following component:
36 \item{matching}{a three-column numeric matrix where the first two
37 columns represent the sibling pairs, and the third one the
38 corresponding ancestor.}
39 \item{tip.label}{(optional) a character vector giving the tip labels
40 where the ith element is the label of the tip numbered i in
42 \item{node.label}{(optional) a character vector giving the node
43 labels in the same order than in \code{matching} (i.e. the ith
44 element is the label of the node numbered i + n in \code{matching},
45 with n the number of tips).}
47 \code{as.phylo.matching} returns an object of class \code{"phylo"}.
50 Branch lengths are not supported in the present version.
52 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
54 Diaconis, P. W. and Holmes, S. P. (1998) Matchings and phylogenetic
55 trees. \emph{Proceedings of the National Academy of Sciences USA},
56 \bold{95}, 14600--14602.
58 \seealso{\code{\link{as.phylo}}}
61 m <- as.matching(bird.orders)
65 all.equal(tr, bird.orders, use.edge.length = FALSE)