## read input dataset "iris"
## Compare the species label with the clustering result
table(iris$Species, kc$cluster)
## Plot the clusters and their centers
plot(newiris[c("Sepal.Length", "Sepal.Width")], col = kc$cluster)
points(kc$centers[, c("Sepal.Length", "Sepal.Width")], col = 1:3, pch = 8, cex = 2)
mydata <- na.omit(iris[, -5])
for (i in 1:15) wss[i] <- sum(kmeans(mydata, centers = i)$withinss)
plot(1:15, wss, type = "b", xlab = "Number of Clusters", ylab = "Within group sum of squares")