# Try out the K means algorithm on a data set of brain and body weight # for various animals. library(MASS) par(mfrow=c(2,2)) set.seed(1) for (s in 1:4) { r = K_means(log(Animals),3) plot(Animals[,1],Animals[,2],pch=20,col=c("red","green","blue")[r$clusters], log="xy",xlab="body weight",ylab="brain weight") }