rotate {ape}R Documentation

Rotate an Internal Branch of a Tree

Description

This function rotates a clade within a tree.

Usage

rotate(phy, group)

Arguments

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.

Details

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.

Value

an object of class "phylo".

Author(s)

Emmanuel Paradis paradis@isem.univ-montp2.fr

See Also

bind.tree, drop.tip, root

Examples

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"))

[Package ape version 1.7 Index]