Merge several clusters/states of an EMM into a single cluster/state.
Usage
# S4 method for class 'EMM,character'
merge_clusters(x, to_merge, clustering = FALSE, new_center = NULL, copy = TRUE)Arguments
- x
an
"EMM"object. Note that the function will change this EMM!- to_merge
vector of names of the states/clusters to merge. The name of the first state in
to_mergeis used as the name for the new state representing the merged states.- clustering
is
to_mergea vector with cluster assignments as created by a clustering algorithm?- new_center
supply new centers for the merged clusters. New centroids are automatically computed. If (pseudo) medoids are used, new medoids should be supplied. If none is supplied, the medoid of the cluster in
to_mergewhich has the most assigned observations is used as the new medoid (warning: this is probably not a good medoid!)- copy
logical; make a copy of x before reclustering? Otherwise the function will change
x!