Principal component analysis (PCA)
MinutePlot® and R on the same data. MinutePlot version 1.0.0; R 4.5.2.
Dataset
- iris — Sepal and petal length and width of 150 iris flowers of three species (R: datasets::iris; Fisher 1936).
- Data file (the same format serves MinutePlot and R): iris.csv — one column per variable; paste it into the app, and keep it in the R script’s folder.
- R built-in: the script uses iris.
Setup
In MinutePlot:
- Workbench → PCA → paste iris.csv → Preview data → first column is sample names UNticked → group column ticked for Species → Confirm → components 4, Scale variables ticked (the default) → Run PCA.
- The four numeric columns are the variables. Ticking first column is sample names on this file would consume Sepal.Length as labels and leave three variables — different numbers.
In R:
- Base R only; then run
iris_pca.Rtop to bottom (source it, or paste it into the console) with the R data file in the same folder. - R 4.5.2 and the package versions in the page header; each script prints the versions it runs under.
The analysis:
- PCA of the four measurements, variables standardised (scale = TRUE; R: prcomp(scale. = TRUE)), all 150 flowers.
- Signs of components are arbitrary; each R component is sign-aligned to MinutePlot’s before comparison.
Side-by-side results
Variance explained (%)
MinutePlot®
| PC1 | PC2 | PC3 | PC4 |
|---|---|---|---|
| 72.962 | 22.851 | 3.669 | 0.518 |
R
| PC1 | PC2 | PC3 | PC4 |
|---|---|---|---|
| 72.962 | 22.851 | 3.669 | 0.518 |
R values: verified in R 4.5.2 (see the verdict).
Loadings
MinutePlot®
| Variable | PC1 | PC2 | PC3 | PC4 |
|---|---|---|---|---|
| Sepal.Length | 0.5211 | 0.3774 | 0.7196 | -0.2613 |
| Sepal.Width | -0.2693 | 0.9233 | -0.2444 | 0.1235 |
| Petal.Length | 0.5804 | 0.0245 | -0.1421 | 0.8014 |
| Petal.Width | 0.5649 | 0.0669 | -0.6343 | -0.5236 |
R
| Variable | PC1 | PC2 | PC3 | PC4 |
|---|---|---|---|---|
| Sepal.Length | 0.5211 | 0.3774 | 0.7196 | -0.2613 |
| Sepal.Width | -0.2693 | 0.9233 | -0.2444 | 0.1235 |
| Petal.Length | 0.5804 | 0.0245 | -0.1421 | 0.8014 |
| Petal.Width | 0.5649 | 0.0669 | -0.6343 | -0.5236 |
R values: verified in R 4.5.2 (see the verdict).
First three scores
MinutePlot®
| Sample | PC1 | PC2 |
|---|---|---|
| setosa 1 | -2.2571 | 0.4784 |
| setosa 2 | -2.0740 | -0.6719 |
| setosa 3 | -2.3563 | -0.3408 |
R
| Sample | PC1 | PC2 |
|---|---|---|
| setosa 1 | -2.2571 | 0.4784 |
| setosa 2 | -2.0740 | -0.6719 |
| setosa 3 | -2.3563 | -0.3408 |
R values: verified in R 4.5.2 (see the verdict).
Verdict
Variance explained (72.96 / 22.85 / 3.67 / 0.52 %), loadings and the first scores agree with R’s printed prcomp output up to the arbitrary sign of PC2 and PC4 (aligned here); no letters in this entry.
R script
iris_pca.R — each script loads its data, prints its versions and the R-side tables shown above, in page order; no plotting.
R values verified in R 4.5.2 (emmeans 2.0.4, multcomp 1.4-32, multcompView 0.1-12, ez 4.5.0, Hmisc 5.3.0, pls 2.9.0, drc 3.0-1, car 3.1-5) on 16–17 September 2026.