Visualization of a correlation matrix
Correlation matrix plot or a dataframe containing results from pairwise
correlation tests. The package internally uses ggcorrplot::ggcorrplot
for
creating the visualization matrix, while the correlation analysis is carried
out using the correlation::correlation
function.
ggcorrmat( data, cor.vars = NULL, cor.vars.names = NULL, output = "plot", matrix.type = "upper", type = "parametric", tr = 0.2, partial = FALSE, k = 2L, sig.level = 0.05, conf.level = 0.95, bf.prior = 0.707, p.adjust.method = "holm", pch = "cross", ggcorrplot.args = list(method = "square", outline.color = "black"), package = "RColorBrewer", palette = "Dark2", colors = c("#E69F00", "white", "#009E73"), ggtheme = ggplot2::theme_bw(), ggstatsplot.layer = TRUE, ggplot.component = NULL, title = NULL, subtitle = NULL, caption = NULL, ... )
data |
Dataframe from which variables specified are preferentially to be taken. |
cor.vars |
List of variables for which the correlation matrix is to be
computed and visualized. If |
cor.vars.names |
Optional list of names to be used for |
output |
Character that decides expected output from this function. If
|
matrix.type |
Character, |
type |
A character specifying the type of statistical approach. Four possible options:
Corresponding abbreviations are also accepted: |
tr |
Trim level for the mean when carrying out |
partial |
Can be |
k |
Number of digits after decimal point (should be an integer)
(Default: |
sig.level |
Significance level (Default: |
conf.level |
Scalar between |
bf.prior |
A number between |
p.adjust.method |
Adjustment method for p-values for multiple
comparisons. Possible methods are: |
pch |
Decides the point shape to be used for insignificant correlation
coefficients (only valid when |
ggcorrplot.args |
A list of additional (mostly aesthetic) arguments that
will be passed to |
package |
Name of the package from which the given palette is to
be extracted. The available palettes and packages can be checked by running
|
palette |
Name of the package from which the given palette is to
be extracted. The available palettes and packages can be checked by running
|
colors |
A vector of 3 colors for low, mid, and high correlation values.
If set to |
ggtheme |
A function, |
ggstatsplot.layer |
Logical that decides whether |
ggplot.component |
A |
title |
The text for the plot title. |
subtitle |
The text for the plot subtitle. Will work only if
|
caption |
The text for the plot caption. |
... |
Currently ignored. |
# for reproducibility set.seed(123) # if `cor.vars` not specified, all numeric variables used ggstatsplot::ggcorrmat(iris) # to get the correlation matrix # note that the function will run even if the vector with variable names is # not of same length as the number of variables ggstatsplot::ggcorrmat( data = ggplot2::msleep, type = "robust", cor.vars = sleep_total:bodywt, cor.vars.names = c("total sleep", "REM sleep"), matrix.type = "lower" ) # to get the correlation analyses results in a dataframe ggstatsplot::ggcorrmat( data = ggplot2::msleep, cor.vars = sleep_total:bodywt, partial = TRUE, output = "dataframe" )
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.