# Creating point clusters of a specified size using R

Given a set of points (x,y), I would like to create K clusters of these points similar to the k-means algorithm. The difference is that I would like to define the number of points contained in a cluster, in my situation I would like them to all be equal. For example, take 30 points and put them into 3 sets of 10 points so that the total distance between points in all clusters is minimized. Ideally I would like to implement the solution using R. Thanks for your help!

• I don't think this would have a unique solution in some circumstances. It seems very close to asking for quantiles in more than one dimension. Are you sure you really want to constrain the clustering in such a way? (Imagine if you had 11 of the points in the exact same location) In a brief search I was able to turn up this paper, but I could not tell if any R implementation existed. Try checking out the Cran Task view for clustering. Aug 19 '11 at 20:04