rotate {ape} | R Documentation |
This function rotates a clade within a tree.
rotate(phy, group)
phy |
an object of class "phylo" . |
group |
a vector of mode numeric or character specifying the tips
defining the clade to rotate, or the string "all" meaning to
rotate the whole tree. |
The argument group
can be one of the three followings: (1) a
vector of mode character (= the labels of the tips); (2) a vector of
mode numeric (= the numbers of these labels in the vector
phy$tip.label
), or (3) the string "all"
. In cases (1)
and (2), the clade is rotated around the most recent common ancestor
of group
. If the latter is not monophyletic, the operation
fails and an error message is issued.
Note that the tree returned is the same than the original one, just its representation is changed.
an object of class "phylo"
.
Emmanuel Paradis paradis@isem.univ-montp2.fr
data(bird.orders) layout(matrix(1:4, 2, 2)) op <- par(cex = 0.5) plot(bird.orders) plot(rotate(bird.orders, 1:5)) plot(rotate(bird.orders, 6:23)) plot(rotate(bird.orders, "all")) layout(matrix(1)) par(op) ### The tree hasn't changed: all.equal(bird.orders, rotate(bird.orders, "all"))