identify.hclust             package:mva             R Documentation

_I_d_e_n_t_i_f_y _C_l_u_s_t_e_r_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:

     `identify.hclust' reads the position of the graphics pointer when
     the (first) mouse button is pressed.  It then cuts the tree at the
     vertical position of the pointer and highlights the cluster
     containing the horizontal position of the pointer.  Optionally a
     function is applied to the index of data points contained in the
     cluster.

_U_s_a_g_e:

     identify(x, FUN = NULL, N = 20, MAXCLUSTER = 20,
         DEV.FUN = NULL, ...)

_A_r_g_u_m_e_n_t_s:

       x: an object of the type produced by `hclust'.

     FUN: (optional) function to be applied to the index numbers of the
          data points in a cluster (see Details below).

       N: the maximum number of clusters to be identified.

MAXCLUSTER: The maximum number of clusters that can be produced by a
          cut (limits the effective vertical range of the pointer). 

 DEV.FUN: (optional) integer scalar. If specified, the corresponding
          graphics device is made active before `FUN' is applied.

     ...: further arguments to `FUN'.

_D_e_t_a_i_l_s:

     By default clusters can be identified using the mouse and an
     `invisible' list of indices of the respective data points is
     returned. 

     If `FUN' is not `NULL', then the index vector of data points is
     passed to this function as first argument, see the examples below.
      The active graphics device for `FUN' can be specified using
     `DEV.FUN'.

     The identification process is terminated by pressing any mouse
     button other than the first, or by clicking outside the graphics
     window.

_V_a_l_u_e:

     Either a list of data point index vectors or a list of return
     values of `FUN'.

_S_e_e _A_l_s_o:

     `hclust', `rect.hclust'

_E_x_a_m_p_l_e_s:

     library(mva)
     data(USArrests)
     hca <- hclust(dist(USArrests))
     plot(hca)
     (x <- identify.hclust(hca))

     data(iris)
     hci <- hclust(dist(iris[,1:4]))
     plot(hci)
     identify.hclust(hci, function(k) print(table(iris[k,5])))

     # open a new device
     dev.set(2)
     plot(hci)
     identify.hclust(hci, function(k) barplot(table(iris[k,5])), DEV.FUN=3)

