Clustering by distance in R
问题 I have a vector of integers which I wish to divide into clusters so that the distance between any two clusters is greater than a lower bound, and within any cluster, the distance between two elements is less than an upper bound. For example, suppose we have the following vector: 1, 4, 5, 6, 9, 29, 32, 36 And set the aforementioned lower bound and upper bound to 19 and 9 respectively, the two vectors below should be a possible result: 1, 4, 5, 6, 9 29, 32, 36 Thanks to @flodel 's comments, I