Perform PCA

AddPCsToEnd(
  inputted.data,
  columns.to.do.PCA.on,
  scale.boolean,
  minimum.variance.percent
)

Arguments

inputted.data

A dataframe.

columns.to.do.PCA.on

A vector of strings that specify the column names to use for PCA.

scale.boolean

Boolean specifying if data should be scaled before PCA.

minimum.variance.percent

Value from 0-100 specifying how much percentage of total variance a principal component needs to meet or exceed to be kept.

Value

A List object that contains 3 elements:

  1. A dataframe with the PCs added to the end and the names of the PC columns.

  2. A vector with the names of PCs.

  3. The pca.results object from prcomp().

See also