I have a series of coordinates. I know that I can cluster these using some of the basic methods like k-means
or hierarchical clustering
. I can also easily find out which is the closest neighbor to each coordinate.
However, how do I split the data into clusters, so that each cluster is exactly of size n
, and that each coordinate only belongs to one cluster?
How could I do this in R
, for example on this data and Euclidean distances:
data(iris)
plot(iris$Sepal.Length, iris$Sepal.Width)