get_pca_loading: Get loading/rotation of PCA results

Description Usage Arguments Value Examples

View source: R/fct_factor_extra.R

Description

Get loading/rotation of PCA results

Usage

1
get_pca_loading(pca_res, pc_name_prefix = NULL, ncp = Inf)

Arguments

pca_res

An object of class PCA (FactoMineR); prcomp and princomp((stats); pca, dudi(adea4); epPCA(ExPosition).

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.

Value

A matrix of loading or rotation of PCA results.

Examples

 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)

chriszheng2016/zstexplorer documentation built on June 13, 2021, 9:47 a.m.