...
pca(x) pca_rotate(x, nf = NULL, rotation = c("varimax", "oblimin"))
x | A data frame or a |
---|---|
nf | Number of components to extract. If |
rotation | Rotation of the factor loadings. May be |
A tidy data frame with either all loadings of principal components
(for pca()
) or a rotated loadings matrix (for pca_rotate()
).
The print()
-method for pca_rotate()
has a
cutoff
-argument, which is a scalar between 0 and 1, indicating
which (absolute) values from the loadings should be blank in the
output. By default, all loadings below .1 (or -.1) are not shown.
data(efc) # recveive first item of COPE-index scale start <- which(colnames(efc) == "c82cop1") # recveive last item of COPE-index scale end <- which(colnames(efc) == "c90cop9") # extract principal components pca(efc[, start:end])#> PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 #> Standard deviation 1.7976 1.1311 0.9665 0.8609 0.8156 0.7951 0.7426 0.7251 #> Eigenvalue 3.2314 1.2793 0.9342 0.7412 0.6651 0.6322 0.5515 0.5258 #> Proportion variance 0.3590 0.1421 0.1038 0.0824 0.0739 0.0702 0.0613 0.0584 #> Cumulative variance 0.3590 0.5012 0.6050 0.6873 0.7612 0.8315 0.8928 0.9512 #> PC9 #> Standard deviation 0.6627 #> Eigenvalue 0.4392 #> Proportion variance 0.0488 #> Cumulative variance 1.0000# extract principal components, varimax-rotation. # number of components based on Kaiser-criteria pca_rotate(efc[, start:end])#> variable PC1 PC2 #> 1 c82cop1 0.2911 0.5964 #> 2 c83cop2 -0.5976 -0.4235 #> 3 c84cop3 -0.6885 -0.1564 #> 4 c85cop4 -0.726 -0.119 #> 5 c86cop5 -0.6426 #> 6 c87cop6 -0.6934 0.1213 #> 7 c88cop7 -0.6768 -0.3796 #> 8 c89cop8 0.6364 #> 9 c90cop9 0.7542 #> #> PC1 PC2 #> Proportion variance 0.312 0.190 #> Cumulative variance 0.312 0.501 #> Proportion explained 0.622 0.378 #> Cumulative explained 0.622 1.000