]> git.donarmstrong.com Git - ape.git/blob - man/reorder.phylo.Rd
f63dda597a920513036b686f60646249cd302ec2
[ape.git] / man / reorder.phylo.Rd
1 \name{reorder.phylo}
2 \alias{reorder.phylo}
3 \title{Internal Reordering of Trees}
4 \description{
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.
8 }
9 \usage{
10 \method{reorder}{phylo}(x, order = "cladewise", ...)
11 }
12 \arguments{
13   \item{x}{an object of class \code{"phylo"}.}
14   \item{order}{a character string: either \code{"cladewise"} (the
15     default), or \code{"pruningwise"}, or any unambiguous abbreviation
16     of these.}
17   \item{\dots}{further arguments passed to or from other methods.}
18 }
19 \details{
20   Because in a tree coded as an object of class \code{"phylo"} each
21   branch is represented by a row in the element `edge', there is an
22   arbitrary choice for the ordering of these rows. \code{reorder} allows
23   to reorder these rows according to two rules: in the
24   \code{"cladewise"} order each clade is formed by a series of
25   contiguous rows; this is the order returned by
26   \code{\link{read.tree}}. In the \code{"pruningwise"} order, rows are
27   arranged so that ``pruning'' the tree (or post-order tree traversal)
28   can be done by descending along the rows of `edge'. The possible
29   multichotomies and branch lengths are preserved.
30 }
31 \value{
32   an object of class \code{"phylo"}.
33 }
34 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
35 \seealso{
36   \code{\link{read.tree}} to read tree files in Newick format,
37   \code{\link[stats]{reorder}} for the generic function
38 }
39 \examples{
40 data(bird.families)
41 tr <- reorder(bird.families, "p")
42 all.equal(bird.families, tr) # uses all.equal.phylo actually
43 all.equal.list(bird.families, tr) # bypasses the generic
44 }
45
46 \keyword{manip}