df <- as_qts_sample(vespa64$igp[1:16])
res_pca <- prcomp(df)
# Plot the data points in a PC plane
# And color points according to a categorical variable
p <- ggplot2::autoplot(res_pca, what = "scores")
p + ggplot2::geom_point(ggplot2::aes(color = vespa64$V[1:16]))
Run the code above in your browser using DataLab