# NOT RUN {
x <- rbind(matrix(rnorm(100, sd = 0.3), ncol = 2),
matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2))
# Compare k-means to hybrid k-means with k=4
km <- kmeans(x, 4)
hkm <- hybrid.kmeans(x,k=4)
par(mfrow=c(1,2))
plot(x[,1],x[,2], col=km$cluster,pch=19, main="K-means")
plot(x[,1],x[,2], col=hkm$cluster,pch=19, main="Hybrid K-means")
# }
Run the code above in your browser using DataLab