Functions and default settings for PCA in R
There is a number of packages available in R that may be used for calculating principal components. Generally, there are two methods for classical PCA:
Different packages are using these two functions but with different default settings for data pre-processing (namely: centering and scalling).
One can also use simply prcomp and princomp functions. Following table shows most popular R packages used for this purpose
stats(princomp,prcomp)FactoMineR(PCA)ade4(dudi.pca)amap(acp)PCAtools(pca) from BioconductorcaMASSExPosition
Default settings for center and scale are presented in the next table.
| Function | Center | Scale | Remarks |
|---|---|---|---|
| princomp | FALSE | FALSE | using SVD |
| prcomp | TRUE | FALSE | |
| PCA | FactoMineR | ||
| dudi.pca | ade4 | ||
| pca | PCAtools from Bioconductor | ||
code fragment
