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.
assignCluster(clusterData, origData, clusterVec)
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.
The original dataframe from which the data used in the clustering solution were taken.
An integer variable containing the cluster membership
assignments for the observations used in creating the clustering solution.
This vector can be created using
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.
1 2 3