I can apply PCA to the iris dataset and plot components 1 and 2 to see how the transformation separates the species.
library(tidyverse)
x <- iris[,1:4] %>% as.matrix()
pca <- prcomp(x, scale. = TRUE)
summary(pca)
as.data.frame(pca$x) %>%
mutate(Species = iris$Species) %>%
ggplot(aes(PC1,PC2, color = Species)) +
geom_point()
My problem is, since prcomp function scaled the values, how can I return them to the original values for the plot? As you can see, the scales go from negative to positive, but the sizes are not negative.
Any help will be greatly appreciated.
