I am doing PCA in R and I got the result. But when I try to plot the first two principal components I get an error:
Warning: Ignoring unknown aesthetics: fill
Error in eval(expr, envir, enclos) : object 'GROUP' not found
Here is my code:
data = read.csv("pca_scores.csv", header = T)
data = data[, c(1:3)]
ggplot(data, aes(PC1, PC2)) +
geom_point(aes(shape = Group)) +
geom_text(aes(label = data$X)) +
stat_ellipse(aes(fill = Group))
I knew the problem is the “Group”. I did not mention the group in the previous code. But I really don't know how to change it