Learn R Programming

sjstats (version 0.17.4)

pca: Tidy summary of Principal Component Analysis

Description

...

Usage

pca(x)

pca_rotate(x, nf = NULL, rotation = c("varimax", "quartimax", "promax", "oblimin", "simplimax", "cluster", "none"))

Arguments

x

A data frame or a prcomp object.

nf

Number of components to extract. If rotation = "varmiax" and nf = NULL, number of components is based on the Kaiser-criteria.

rotation

Rotation of the factor loadings. May be one of "varimax", "quartimax", "promax", "oblimin", "simplimax", "cluster" or "none".

Value

A tidy data frame with either all loadings of principal components (for pca()) or a rotated loadings matrix (for pca_rotate()).

Details

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.

Examples

Run this code
# NOT RUN {
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])

# extract principal components, varimax-rotation.
# number of components based on Kaiser-criteria
pca_rotate(efc[, start:end])

# }

Run the code above in your browser using DataLab