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
the matrix of variable loadings (i.e., a matrix whose columns contain the eigenvectors). The function princomp returns this in the element loadings.
x
if retx is true the value of the rotated data (the centred (and scaled if requested) data multiplied by the rotation matrix) is returned. Hence, cov(x) is the diagonal matrix diag(sdev^2). For the formula method, napredict() is applied to handle the treatment of values omitted by the na.action.
center, scale
```

We have the sdev that is the standard deviations we can do the calculation:

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

We now have it in the variable pov, proportion of variance. You can plot it

`barplot(pov)`

prcomp source: https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/prcomp