File:Pca ggplot2.png: Revision history

Jump to navigation Jump to search

Diff selection: Mark the radio buttons of the revisions to compare and hit enter or the button at the bottom.
Legend: (cur) = difference with latest revision, (prev) = difference with preceding revision, m = minor edit.

23 May 2024

  • curprev 09:5809:58, 23 May 2024Brb talk contribs 284 bytes +284 <syntaxhighlight lang='r'> df <- iris[, 1:4] # exclude "Species" column pca_res <- prcomp(df, scale = TRUE) ggplot(iris, aes(x = pca_res$x[,1], y = pca_res$x[,2], color = Species)) + geom_point() + stat_ellipse() </syntaxhighlight>