RC_PCA_loading: RC_PCA_loading

Description Usage Arguments Author(s) Examples

View source: R/RC_PCA_loading.R

Description

Return the loading (V matrix) plot of a PCA.

Usage

1

Arguments

data

Your data to use to set up the PCA.

cos2

A value between 0:1 to select the features to plot by contribution.

Author(s)

Benjamin Vittrant

Examples

 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)
}

bvittrant/RCommon documentation built on May 4, 2020, 3:04 p.m.