R/getPcaVars.R
getPcaVars.Rd
Given a PCA object created with prcomp, this function computes the percent of variance explained by each of the principal components.
getPcaVars(pca, digits = 3)
An object created with prcomp.
The number of significant digits to round to.
A vector with the percent of variance explained for each of the principal components in decreasing order.
pca <- prcomp(USArrests)
getPcaVars(pca)
#> [1] 96.6000 2.7800 0.5800 0.0849