[Solved] Plot 6-D into 2-D in r [closed]


The simplest thing would be to use PCA to reduce the dimensionality of your data to 2 or 3 dimensions. k-means clustering ought to assign a group to each row of your data so you can easily plot the different groups on the reduced dataset. Here’s a simple way to do PCA though you could also do LLE or other forms of dimensional reduction.

data(iris)
unique(iris$Species)
#[1] setosa     versicolor virginica
iris.pca<-princomp(iris[,c("Sepal.Length", "Sepal.Width", "Petal.Width", "Petal.Width")], center=T, scale=T)


plot(iris.pca$scores[,1], iris.pca$scores[,2], col=iris$Species)

1

solved Plot 6-D into 2-D in r [closed]