reorder.dendrogram           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:

     A method for the generic function 'reorder'.

     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:

     ## S3 method for class 'dendrogram':
     reorder(x, wts, agglo.FUN = sum, ...)

_A_r_g_u_m_e_n_t_s:

       x: the (dendrogram) object to be reordered

     wts: numeric weights (arbitrary values) for reordering.

agglo.FUN: a function for weights agglomeration, see below.

     ...: 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.  At each node, the branches are ordered in increasing
     weights where the weight of a branch is defined as f(w_j) where f
     is 'agglo.FUN' and w_j is the weight of the j-th sub branch).

_V_a_l_u_e:

     A dendrogram where each node has a further attribute 'value' with
     its corresponding weight.

_A_u_t_h_o_r(_s):

     R. Gentleman and M. Maechler

_S_e_e _A_l_s_o:

     'reorder'.

     'rev.dendrogram' which simply reverses the nodes' order;
     '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)
       plot(dd, main = "random dendrogram `dd'")

       op <- par(mfcol = 1:2)
       plot(dd.reorder, main = "reorder(dd, 10:1)")
       plot(reorder(dd,10:1, agglo.FUN= mean),
            main = "reorder(dd, 10:1, mean)")
       par(op)

