]> git.donarmstrong.com Git - ape.git/blob - man/reorder.phylo.Rd
provisional version of the new reorder.phylo()
[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", index.only = FALSE, ...)
11 }
12 \arguments{
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.}
20 }
21 \details{
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.
32 }
33 \value{
34   an object of class \code{"phylo"}, or a numeric vector if \code{index.only = TRUE}.
35 }
36 \author{Emmanuel Paradis}
37 \seealso{
38   \code{\link{read.tree}} to read tree files in Newick format,
39   \code{\link[stats]{reorder}} for the generic function
40 }
41 \examples{
42 data(bird.families)
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
46 }
47
48 \keyword{manip}