Description Usage Arguments Value Examples
View source: R/fct_factor_extra.R
Get loading/rotation of PCA results
1 | get_pca_loading(pca_res, pc_name_prefix = NULL, ncp = Inf)
|
pca_res |
An object of class PCA ( |
pc_name_prefix |
A character as name prefix of primary components in results, e.g PC for PC1...PCn. Default NULL means use original name of primary components. |
ncp |
A number of primary components kept in the results. Default Inf means all primary components. |
A matrix of loading or rotation of PCA results.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
# Result from prcomp
pca_res_prcomp <- prcomp(iris[, -5], scale = TRUE)
pca_loading <- get_pca_loading(pca_res_prcomp)
# Result from princomp
pca_res_princomp <- princomp(scale(iris[, -5]))
pca_loading <- get_pca_loading(pca_res_princomp)
# Result from FactoMineR::PCA
pca_res_PCA <- FactoMineR::PCA(iris[, -5], ncp = ncol(iris[, -5]), graph = FALSE)
pca_loading <- get_pca_loading(pca_res_PCA)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.