The wikibook on kmeans clustering (http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Clustering/K-Means) gives an example cluster analysis :
Can the code be amended so that a label is generated from each cluster? Below graph does not indicate what is being compared. There are three clusters but what are the names of each cluster ?
Here is the code that generates the graph :
# import data (assume that all data in "data.txt" is stored as comma separated values)
x <- read.csv("data.txt", header=TRUE, row.names=1)
# run K-Means
km <- kmeans(x, 3, 15)
# print components of km
print(km)
# plot clusters
plot(x, col = km$cluster)
# plot centers
points(km$centers, col = 1:2, pch = 8)