While using R, PCA and plotting cumulative variance

I am working with R using a scaled dataset and principal component analysis (princomp). Everything works fine, but I would like to graph the cumulative % variances of principle components to the whole. The summary provides this information, but I am not able to access it yet. In other words, I want to y='Cumulative Proportion' from pca vs. 'component#'. pca <- princomp(class5_subset_scaled) summary(pca) # Summary provides Output: Importance of components: Comp.1 Comp.2 ... Standard deviation 0.0513980 0.04482971 ... Proportion of Variance 0.2089728 0.15897513 ... Cumulative Proportion 0.2089728 0.36794789 ... However, when I look at the names, I am puzzled... names(pc) Output: [1] "sdev" "loadings" "center" "scale" "n.obs" "scores" "call" Can I plot y='Cumulative Proportion' from pca vs. x='component#'?
Take Your Experience to the Next Level
NewDownload our mobile app for a faster and better experience.
Comments
0U
Join the discussion
Sign in to leave a comment