There seems to be a lot of information about creating either hierarchical or k-means clusters. But I would like to know if there is an solution in R that would create K clusters of approximately equal sizes. There is some stuff out there about doing this in other languages, but I have not been able to find anything from searching on the internet that suggests how to achieve the result in R.
An example would be
set.seed(123)
df <- matrix(rnorm(100*5), nrow=100)
km <- kmeans(df, 10)
print(sapply(1:10, function(n) sum(km$cluster==n)))
which results in
[1] 14 12 4 13 16 6 8 7 13 7
I would ideally like to see
[1] 10 10 10 10 10 10 10 10 10 10