dendrogram                package:mva                R Documentation

_G_e_n_e_r_a_l _T_r_e_e _S_t_r_u_c_t_u_r_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Class `"dendrogram"' provides general functions for handling
     tree-like structures.  It is intended as a replacement for similar
     functions in hierarchical clustering and classification/regression
     trees, such that all of these can use the same engine for plotting
     or cutting trees.  Currently the code is in alpha stage and the
     API may change at any point in time.

_U_s_a_g_e:

     plot(x, type=c("rectangle", "triangle"),
              center=FALSE, xlab="", ylab="", ...)
     cut(x, h, ...)

_A_r_g_u_m_e_n_t_s:

       x: object of class `"dendrogram"'.

    type: type of plot.

  center: logical; if `TRUE', nodes are plotted centered with respect
          to the leaves in the branch.  Otherwise (default), plot them
          in the middle of all direct child nodes.

       h: height at which the tree is cut.

..., xlab, ylab: graphical parameters, or arguments for other methods.

_D_e_t_a_i_l_s:

     Warning: This documentation is preliminary.

     The dendrogram is directly represented as a nested list where each
     component corresponds to a branch of the tree.  Hence, the first
     branch of tree `z' is `z[[1]]', the second branch of the
     corresponding subtree is `z[[1]][[2]]' etc.. Each node of the tree
     carries some information needed for efficient plotting or cutting
     as attributes:

     `_m_e_m_b_e_r_s' total number of leaves in the branch

     `_h_e_i_g_h_t' numeric non-negative height at which the node is plotted.

     `_m_i_d_p_o_i_n_t' numeric horizontal distance of the node from the left
          border of the branch.  This is needed at least for `plot(*,
          center=FALSE)'.

     `_t_e_x_t' character; the label of the node

     `_e_d_g_e_t_e_x_t' character; the label for the edge leading to the node

     Terminal nodes (leaves of the tree) can have arbitrary value but
     must not be a list.

     `cut.dendrogram()' returns a list with components `$upper' and
     `$lower', the first is a truncated version of the original tree,
     also of class `dendrogram', the latter a list with the branches
     obtained from cutting the tree, each a `dendrogram'.

     Objects of class `"hclust"' can be converted to class
     `"dendrogram"' using method `as.dendrogram'.

     `plotNode()' and `plotNodeLimit()' are helper functions.

_E_x_a_m_p_l_e_s:

     library(mva)
     data(USArrests)
     hc <- hclust(dist(USArrests), "ave")
     str(dend1 <- as.dendrogram(hc))
     plot(dend1)
     dend2 <- cut(dend1, h=70)
     plot(dend2$upper)
     ##  dend2$lower is *NOT* a dendrogram, but a list of .. :
     plot(dend2$lower[[3]])

