Description Usage Arguments Value Author(s) References Examples
Extract all the results (coordinates, squared cosine, contributions) for
the active individuals/variables from Principal Component Analysis (PCA) outputs.
get_pca(): Extract the results for variables and individuals
get_pca_ind(): Extract the results for individuals only
get_pca_var(): Extract the results for variables only
1 2 3 4 5 | get_pca(res.pca, element = c("var", "ind"))
get_pca_ind(res.pca, ...)
get_pca_var(res.pca)
|
res.pca |
an object of class PCA [FactoMineR]; prcomp and princomp [stats]; pca, dudi [adea4]; epPCA [ExPosition]. |
element |
the element to subset from the output. Allowed values are "var" (for active variables) or "ind" (for active individuals). |
... |
not used |
a list of matrices containing all the results for the active individuals/variables including:
coord |
coordinates for the individuals/variables |
cos2 |
cos2 for the individuals/variables |
contrib |
contributions of the individuals/variables |
Alboukadel Kassambara alboukadel.kassambara@gmail.com
http://www.sthda.com/english/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Principal Component Analysis
# +++++++++++++++++++++++++++++
data(iris)
res.pca <- prcomp(iris[, -5], scale = TRUE)
# Extract the results for individuals
ind <- get_pca_ind(res.pca)
print(ind)
head(ind$coord) # coordinates of individuals
head(ind$cos2) # cos2 of individuals
head(ind$contrib) # contributions of individuals
# Extract the results for variables
var <- get_pca_var(res.pca)
print(var)
head(var$coord) # coordinates of variables
head(var$cos2) # cos2 of variables
head(var$contrib) # contributions of variables
# You can also use the function get_pca()
get_pca(res.pca, "ind") # Results for individuals
get_pca(res.pca, "var") # Results for variable categories
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.