"phylo"
. The tree returned is the same than
the one input, but the ordering of the edges could be different.
"reorder"(x, order = "cladewise", index.only = FALSE, ...)
"reorder"(x, order = "cladewise", ...)
"phylo"
or "multiPhylo"
."cladewise"
(the
default), "postorder"
, "pruningwise"
, or any
unambiguous abbreviation of these."phylo"
(with the attribute "order"
set accordingly), or a numeric vector if index.only = TRUE
; if
x
is of class "multiPhylo"
, then an object of the same
class.
"phylo"
each
branch is represented by a row in the element `edge', there is an
arbitrary choice for the ordering of these rows. reorder
allows
to reorder these rows according to three rules: in the
"cladewise"
order each clade is formed by a series of
contiguous rows. In the "postorder"
order, the rows are
arranged so that computations following pruning-like algorithm the
tree (or postorder tree traversal) can be done by descending along
these rows (conversely, a preorder tree traversal can be performed by
moving from the last to the first row). The "pruningwise"
order
is an alternative ``pruning'' order which is actually a bottom-up
traversal order (Valiente 2002). (This third choice might be removed
in the future as it merely duplicates the second one which is more
efficient.) The possible multichotomies and branch lengths are preserved.Note that for a given order, there are several possible orderings of the rows of `edge'.
read.tree
to read tree files in Newick format,
reorder
for the generic function
data(bird.families)
tr <- reorder(bird.families, "postorder")
all.equal(bird.families, tr) # uses all.equal.phylo actually
all.equal.list(bird.families, tr) # bypasses the generic
Run the code above in your browser using DataLab