order.dendrogram            package:stats            R Documentation

_O_r_d_e_r_i_n_g _o_r _L_a_b_e_l_s _o_f _t_h_e _L_e_a_v_e_s _i_n _a _D_e_n_d_r_o_g_r_a_m

_D_e_s_c_r_i_p_t_i_o_n:

     Theses functions return the order (index) or the '"label"'
     attribute for the leaves in a dendrogram.  These indices can then
     be used to access the appropriate components of any additional
     data.

_U_s_a_g_e:

     order.dendrogram(x)

     ## S3 method for class 'dendrogram':
     labels(object, ...)

_A_r_g_u_m_e_n_t_s:

x, object: a dendrogram (see 'as.dendrogram').

     ...: additional arguments

_D_e_t_a_i_l_s:

     The indices or labels for the leaves in left to right order are
     retrieved.

_V_a_l_u_e:

     A vector with length equal to the number of leaves in the
     dendrogram is returned.  From 'r <- order.dendrogram()', each
     element is the index into the original data (from which the
     dendrogram was computed).

_A_u_t_h_o_r(_s):

     R. Gentleman ('order.dendrogram' and Martin Maechler
     ('labels.dendrogram').

_S_e_e _A_l_s_o:

     'reorder', 'dendrogram'.

_E_x_a_m_p_l_e_s:

     set.seed(123)
     x <- rnorm(10)
     hc <- hclust(dist(x))
     hc$order
     dd <- as.dendrogram(hc)
     order.dendrogram(dd) ## the same :
     stopifnot(hc$order == order.dendrogram(dd))

     d2 <- as.dendrogram(hclust(dist(USArrests)))
     labels(d2) ## in this case the same as
     stopifnot(labels(d2) == rownames(USArrests)[order.dendrogram(d2)])

