rotate                  package:ape                  R Documentation

_R_o_t_a_t_e _a_n _I_n_t_e_r_n_a_l _B_r_a_n_c_h _o_f _a _T_r_e_e

_D_e_s_c_r_i_p_t_i_o_n:

     This function rotates a clade within a tree.

_U_s_a_g_e:

     rotate(phy, group)

_A_r_g_u_m_e_n_t_s:

     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.

_D_e_t_a_i_l_s:

     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.

_V_a_l_u_e:

     an object of class '"phylo"'.

_A_u_t_h_o_r(_s):

     Emmanuel Paradis paradis@isem.univ-montp2.fr

_S_e_e _A_l_s_o:

     'bind.tree', 'drop.tip', 'root'

_E_x_a_m_p_l_e_s:

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

