Identifying the most important variables in data with PCA can be done using the following steps:
- Perform PCA:
library(factoextra) pca_result <- prcomp(iris[,-5], scale=TRUE, center=TRUE )
- Create a variable plot:
fviz_pca_var(pca_result, col.var="cos2")