Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201945

How would I split a PCA analysis histogram that show the number of main PCs into multiple plots using a for loop?

$
0
0

I have performed PCA Analysis using the prcomp function apart of the FactoMineR package on quite a substantial dataset of 3000 x 500.

I have tried plotting the main Principal Components that cover up to 100% of cumulative variance proportion with a fviz_eig plot. However, this is a very large plot due to the large dimensions of the dataset. Is there any way in R to split a plot into multiple plots using a for loop or any other way?

Any help would be greatly appreciated.

Edited Reproducible example:

This is only a small reproducible example using an already available dataset in R but I used a similar method for my large dataset. It will show you how the plot actually works. However, my large dataset has a lot more PCs that this one (possibly 100 or more to cover up to 100% of cumulative variance proportion) and therefore this is why I would like a way to split the single plot into multiple plots for better visualisation.

# Already existing data in R.
install.packages("boot")
library(boot)
data(frets)
frets

dataset_pca <- prcomp(frets)
dataset_pca$x

fviz_eig(dataset_pca, addlabels = TRUE, ylim = c(0, 100))

PCA Analysis Fviz_eig plot


Viewing all articles
Browse latest Browse all 201945

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>