4 \alias{as.matching.phylo}
5 \alias{as.phylo.matching}
6 \title{Conversion Between Phylo and Matching Objects}
8 These functions convert objects between the classes \code{"phylo"} and
13 \method{as.matching}{phylo}(x, labels = TRUE, ...)
14 \method{as.phylo}{matching}(x, ...)
17 \item{x}{an object to convert as an object of class \code{"matching"}
18 or of class \code{"phylo"}.}
19 \item{labels}{a logical specifying whether the tip and node labels
20 should be included in the returned matching.}
21 \item{\dots}{further arguments to be passed to or from other methods.}
24 A matching is a representation where each tip and each node are given
25 a number, and sibling groups are grouped in a ``matching pair'' (see
26 Diaconis and Holmes 1998, for details). This coding system can be used
27 only for binary (fully dichotomous) trees.
29 Diaconis and Holmes (1998) gave some conventions to insure that a
30 given tree has a unique representation as a matching. I have tried to
31 follow them in the present functions.
34 \code{as.matching} returns an object of class \code{"matching"} with
35 the following component:
37 \item{matching}{a two-column numeric matrix where the columns
38 represent the sibling pairs.}
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}
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)