Custom Principle Component Analysis (PCA) Plots in R

There are several functions that calculate principal component statistics in R. Two of these are “prcomp()” and “princomp()”. The “prcomp()” function has fewer features, but is numerically more stable than “princomp()”. Both of these functions can be invoked by simply passing in a suitable data frame, in which case all columns will be used: pca1 = prcomp(d) pca2 = princomp(d) Alternatively, the columns to be used can be specified using a formula notation:

Read more