if (requireNamespace("ggplot2", quietly = TRUE)) {
set.seed(42)
fit <- rpca(iris[, 1:4], k = 2)
last_plot <- plot(fit, type = "ratio", pcs = c(1, 2),
groups = iris$Species, ind_labels = FALSE,
ellipse = FALSE)
# Request a single plot directly for further customization or saving.
scree <- ggscreeplot(fit, type = "cum")
}
Run the code above in your browser using DataLab