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

