3 \title{Internal Reordering of Trees}
5 This function changes the internal structure of a phylogeny stored as
6 an object of class \code{"phylo"}. The tree returned is the same than
7 the one input, but the ordering of the edges could be different.
10 \method{reorder}{phylo}(x, order = "cladewise", index.only = FALSE, ...)
13 \item{x}{an object of class \code{"phylo"}.}
14 \item{order}{a character string: either \code{"cladewise"} (the
15 default), \code{"postorder"}, \code{"pruningwise"}, or any
16 unambiguous abbreviation of these.}
17 \item{index.only}{should the function return only the ordered indices
18 of the rows of the edge matrix?}
19 \item{\dots}{further arguments passed to or from other methods.}
22 Because in a tree coded as an object of class \code{"phylo"} each
23 branch is represented by a row in the element `edge', there is an
24 arbitrary choice for the ordering of these rows. \code{reorder} allows
25 to reorder these rows according to two rules: in the
26 \code{"cladewise"} order each clade is formed by a series of
27 contiguous rows; this is the order returned by
28 \code{\link{read.tree}}. In the \code{"pruningwise"} order, rows are
29 arranged so that ``pruning'' the tree (or post-order tree traversal)
30 can be done by descending along the rows of `edge'. The possible
31 multichotomies and branch lengths are preserved.
34 an object of class \code{"phylo"}, or a numeric vector if \code{index.only = TRUE}.
36 \author{Emmanuel Paradis}
38 \code{\link{read.tree}} to read tree files in Newick format,
39 \code{\link[stats]{reorder}} for the generic function
43 tr <- reorder(bird.families, "p")
44 all.equal(bird.families, tr) # uses all.equal.phylo actually
45 all.equal.list(bird.families, tr) # bypasses the generic