replaceClusters replaces cluster columns in a netCoin object from surScat.
Removes all existing cluster columns and adds the new one.
replaceClusters(scatObj, clusters, name=NULL, sort=TRUE,
weight=NULL, sourceData=NULL, which=NULL, maxGroups=25)A 'netCoin' object.
A 'netCoin' object.
vector, factor, data.frame holding one clusterization per column, or clustering object (kmeans, poLCA, tidyLPA, looking4clusters).
name of the new cluster column. 'clusters' by default. When several clusterizations are added at once, each column keeps its own name, and 'name' becomes a prefix.
sort clusters if requested (by mean coordinate on first layout axis).
a vector of weights.
optional data.frame for validation that clusters are in correct order.
clusterization to take when 'clusters' is a 'looking4clusters' object, given as
a name or an index. Methods run for several numbers of groups yield their optimal solution,
unless a specific number is asked for with the "name:k" form, as in which="kmeans:4".
When it is left empty, every clusterization held by the object is added as its own column,
one per number of groups, named after the method and that number, as in "kmeans(4)".
clusterizations with more groups than this are skipped with a warning, which keeps a continuous variable passed in by mistake from becoming a column of hundreds of groups. NULL adds them all.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca.
The columns to remove are the ones surScat and addClusters recorded as holding
clusterizations, so variables of the study are never removed, whatever they are named. Objects
built before this was recorded fall back to the name of the column surScat creates.
The entries of $clusters (see surScat and addClusters) belonging to the
removed clusterizations are dropped along with their columns, and the new clusterization gets
an entry of its own, its groups' centroids computed on every plane the object holds.