How to plot the second and third principal components after using prcomp
?
More variance is explained by the second and third principal components on my variables of greatest interest.
Here is the code I'm using for the first and second:
res.pca <- prcomp(data3, scale = TRUE)
fviz_eig(res.pca)
fviz_pca_ind(res.pca,
col.ind = "cos2", # Color by the quality of representation
gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
repel = TRUE # Avoid text overlapping
)