ape (version 1.8-4)

rotate: Rotate an Internal Branch of a Tree

Description

This function rotates a clade within a tree.

Usage

rotate(phy, group)

Arguments

Value

an object of class "phylo".

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.

See Also

bind.tree, drop.tip, root

Examples

Run this code
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"))

Run the code above in your browser using DataCamp Workspace