All variables must be continuous.
The matrix will be returned as an element of ggplot
object.
This is basically a wrapper of R package
ggcorrplot.
show_cor( data, x_vars = colnames(data), y_vars = x_vars, cor_method = "spearman", vis_method = "square", lab = TRUE, test = TRUE, hc_order = FALSE, p_adj = NULL, ... )
data | a |
---|---|
x_vars | variables/column names shown in x axis. |
y_vars | variables/column names shown in y axis. |
cor_method | method for correlation, default is 'spearman'. |
vis_method | visualization method, default is 'square', can also be 'circle'. |
lab | logical value. If TRUE, add correlation coefficient on the plot. |
test | if |
hc_order | logical value. If |
p_adj | p adjust method, see stats::p.adjust for details. |
... | other parameters passing to |
a ggplot
object
show_sig_feature_corrplot for specific and more powerful association analysis and visualization.
data("mtcars") p1 <- show_cor(mtcars) p2 <- show_cor(mtcars, x_vars = colnames(mtcars)[1:4], y_vars = colnames(mtcars)[5:8] ) p3 <- show_cor(mtcars, vis_method = "circle", p_adj = "fdr") p1 p1$cor p2 p3 ## Auto detect problem variables mtcars$xx <- 0L p4 <- show_cor(mtcars) p4