assignCluster             package:Rcmdr             R Documentation

_A_p_p_e_n_d _a _C_l_u_s_t_e_r _M_e_m_b_e_r_s_h_i_p _V_a_r_i_a_b_l_e _t_o _a _D_a_t_a_f_r_a_m_e

_D_e_s_c_r_i_p_t_i_o_n:

     Correctly creates a cluster membership variable that can be
     attached to a dataframe when only a subset of the observations in
     that dataframe were used to create the clustering solution. NAs
     are assigned to the observations of the original dataframe not
     used in creating the clustering solution.

_U_s_a_g_e:

     assignCluster(clusterData, origData, clusterVec)

_A_r_g_u_m_e_n_t_s:

clusterData: The data matrix used in the clustering solution. The data
          matrix may have have only a subset of the observations
          contained in the original dataframe.

origData: The original dataframe from which the data used in the
          clustering solution were taken.

clusterVec: An integer variable containing the cluster membership 
          assignments for the observations used in creating the
          clustering solution. This vector can be created using
          'cutree' for clustering solutions generated by 'hclust' or
          the 'cluster' component of a list object created by 'kmeans'
          or 'KMeans'.

_V_a_l_u_e:

     A factor (with integer labels) that indicate the cluster
     assignment for each observation, with an NA value given to
     observations not used in the clustering solution.

_A_u_t_h_o_r(_s):

     Dan Putler

_S_e_e _A_l_s_o:

     'hclust', 'cutree', 'kmeans',  'KMeans'

_E_x_a_m_p_l_e_s:

       data(USArrests)
       USArrkm3 <- KMeans(USArrests[USArrests$UrbanPop<66, ], centers=3)
       assignCluster(USArrests[USArrests$UrbanPop<66, ], USArrests, USArrkm3$cluster)

