# How to get proportion of variance from prcomp in R

How to get proportion of variance from prcomp in R you might ask? You can see the value if you do a summary of prcomp

``````pca <- prcomp(data, [, -1], scale = TRUE)
summary(pca)``````

You’ll get something that look like this:

``````                          PC1
Standard deviation     6.3009
Proportion of Variance 0.1225
Cumulative Proportion  0.1225``````

However, to actually get the value you can calculated it from the standard deviation variables. If you do a ? help on prcomp you can see all the values that are available

``````prcomp returns a list with class "prcomp" containing the following components:

sdev
the standard deviations of the principal components (i.e., the square roots of the eigenvalues of the covariance/correlation matrix, though the calculation is actually done with the singular values of the data matrix).

rotation
``pov <- pca\$sdev^2/sum(pca\$sdev^2)``
``barplot(pov)``