Extracts all factors of a principal component analysis of a matrix or data frame. Just a convenient wrapper for prcomp.
pca(
  x = NULL,
  colnames.prefix = "pca_factor"
)numeric matrix or data frame, Default: NULL
character, name prefix for the output columns, Default: 'pca_factor'
A data frame with the PCA factors of x.
Columns in x with zero variance are removed before computing the PCA.
if(interactive()){
 #load example distance matrix
 data(distance_matrix)
 #PCA of the distance matrix
 out <- pca(x = distance_matrix)
 out
}