I am trying to use the following function here http://www.r-bloggers.com/using-r-two-plots-of-principal-component-analysis/
what I do is as follow:
data(iris)
df <- iris[,1:4]
variable.groups <- c(rep(1,50), rep(2,50), rep(3,50))
library(reshape2)
library(ggplot2)
pca <- prcomp(df, scale=TRUE)
melted <- cbind(variable.groups, melt(pca$rotation[,1:4]))
I get an error saying
Error in data.frame (..., check.names=FALSE): arguments imply differing number of rows: 150, 16
what I basically dont understand, is the melting in the above link, is there any idea, how i can set the iris data the same ?