fix_empty: Certify that, given enough points, no clusters are left empty
Description
Certifies that, given enough points, no clusters are left empty. This is done
by removing a point from the largest cluster and adding it to an empty
cluster while there are empty clusters. If the total number of points is
smaller than the number of clusters (or if the allow_empty parameter is set
to TRUE), this function does nothing.
Usage
fix_empty(clu_num_points, allow_empty = FALSE)
Value
Number of points in each cluster, after being fixed by this function
(vector of size c).
Arguments
clu_num_points
Number of points in each cluster (vector of size
c), where c is the number of clusters.
allow_empty
Allow empty clusters?
Details
This function is used internally by clusizes and might be useful for custom
cluster sizing implementations given as the clusizes_fn parameter of the
main clugen function.
clusters <- c(3, 4, 5, 0, 0) # A vector with some empty elementsclusters <- fix_empty(clusters) # Apply this functionclusters # Check that there's no more empty elements