reorder                package:stats                R Documentation

_R_e_o_r_d_e_r _a _d_e_n_d_r_o_g_r_a_m

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

     There are many different orderings of a dendrogram that are
     consistent with the structure imposed.  This function takes a
     dendrogram and a vector of values and reorders the dendrogram in
     the order of the supplied vector, maintaining the constraints on
     the dendrogram.

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

     reorder(x, ...)

     ## S3 method for class 'dendrogram':
     reorder(x, wts, ...)

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

       x: the object to be reordered

     wts: numeric weights (arbitrary values) for reordering.

     ...: additional arguments

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

     Using the weights 'wts', the leaves of the dendrogram are
     reordered so as to be in an order as consistent as possible with
     the weights.  Afterward, at each node, the branches are ordered in
     increasing weights (where the weight of a branch is defined as the
     sum of the weights of its sub branches).

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

     From 'reorder.dendrogram' a dendrogram, where each node has a
     further attribute 'value' with its corresponding weight.

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

     R. Gentleman

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

     'heatmap', 'cophenetic'

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

       set.seed(123)
       x <- rnorm(10)
       hc <- hclust(dist(x))
       dd <- as.dendrogram(hc)
       dd.reorder <- reorder(dd, 10:1)

       op <- par(mfcol = 1:2)
       plot(dd, main = "random dendrogram `dd'")
       plot(dd.reorder, main = "reorder(dd, 10:1)")
       par(op)

