Skip to main content
2 of 2
added comment cocerning withinss
Dave2e
  • 1.8k
  • 5
  • 19
  • 20

The numbers reported for the centers are the coordinates of each center in n-dimensional space. For example, the iris data has 3 centers in 4 D space thus the 3 rows and 4 columns. Your original problem had specified 20 centers(ie rows) and then 7 columns for each dimension.

The kmeans parameter withinss (myclustering$withinss) is the measure of the cluster's sum of the square error, thus a measure of how close each point of the cluster is to the center.

To compute the distance between the centers, the dist() function is helpful.

dist(myclustering$centers)
#          1        2
#2 5.017569         
#3 3.356935 1.797182

thus centers 2 &3 are the closest to each other and centers 1&2 are the farthest apart.

Dave2e
  • 1.8k
  • 5
  • 19
  • 20