I performing k mean clustering analysis on the Iris dataset in R. I am trying to produce a pairwise plot of all the different combinations of attributes (Sepal.Length, Sepal.Width, Petal.Length and Petal.Width) clustered using kmeans with a center of 3. I was able to produce the plot for the first combination (Sepal Length v Sepal Width) which is as follows:
attach(iris)
iris.scaled <- scale(iris[, -5])
k <- kmeans(iris.scaled,centers=3)
plot(iris.scaled[,1],iris.scaled[,2],col=KM$cluster,)
However, I am unsure how to do this for all 6 possible combinations of attributes and have a 4 by 4 pairwise plot. I thought maybe the pairs
function but have no such luck
k <- kmeans(iris.scaled,centers=3)
Error in as.matrix(x) : object 'iris.scaled' not found – Will