I've read through this explanation here regarding calculating the variance explained from PCA output. I think I got it right but might be off in my interpretation of R output.
In the example below, I would like to calculate the percentage of variance explained by the first principal component of the USArrests dataset.
pca <- prcomp(USArrests, scale = TRUE)
eigs <- pca$sdev^2
eigs[1] / sum(eigs)
[1] 0.6200604
I assumed that R uses sdev
as the square root of the eigen values. So I square it and divide the first value by the total. Is this correct?