Description Usage Arguments Author(s) Examples
View source: R/RC_PCA_loading.R
Return the loading (V matrix) plot of a PCA.
1 |
data |
Your data to use to set up the PCA. |
cos2 |
A value between 0:1 to select the features to plot by contribution. |
Benjamin Vittrant
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
RC_PCA_loading = function(data, cos2){
res.pca = PCA(data, graph = FALSE)
tmp = median(res.pca$var$contrib)
p = fviz_pca_var(res.pca, col.var="contrib", select.var = list(cos2=cos2)) +
scale_color_gradient2(low="white", mid="blue",
high="red", midpoint=tmp, space = "Lab") +
theme_minimal()
return(p)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.