# ggcorrmat

0th

Percentile

##### Visualization of a correlalogram (or correlation matrix) using 'ggplot2'/'ggcorrplot'

Visualization of a correlalogram (or correlation matrix) using 'ggplot2'/'ggcorrplot'

##### Usage
ggcorrmat(data, cor.vars, cor.vars.names = NULL, output = "plot",
type = "full", method = "square", corr.method = "pearson",
exact = FALSE, continuity = TRUE, digits = 2, sig.level = 0.05,
hc.order = FALSE, hc.method = "complete", lab = TRUE,
colors = c("#6D9EC1", "white", "#E46726"), outline.color = "black",
ggtheme = ggplot2::theme_gray, title = NULL, subtitle = NULL,
caption = NULL, caption.default = TRUE, lab_col = "black",
lab_size = 4.5, insig = "pch", pch = 4, pch.col = "blue",
pch.cex = 10, tl.cex = 12, tl.col = "black", tl.srt = 45)
##### Arguments
data

Dataframe from which variables specified are preferentially to be taken.

cor.vars

List of vairables for which the correlation matrix is to be computed and visualized.

cor.vars.names

Optional list of names to be used for cor.vars. The names should be entered in the same order.

output

Expected output from this function: "plot" (visualization matrix) or "correlations" (correlation matrix) or "p-values" (matrix of p-values).

type

Character, "full" (default), "upper" or "lower", display full matrix, lowe triangular or upper triangular matrix.

method

Character argument that decides the visualization method of correlation matrix to be used. Allowed values are "square" (default), "circle"

corr.method

A character string indicating which correlation coefficient is to be computed ("pearson" (default) or "kendall" or "spearman"). Abbreviations will not work.

exact

A logical indicating whether an exact p-value should be computed. Used for Kendall's tau and Spearman's rho. For more details, see ?stats::cor.test.

continuity

A logical. If TRUE, a continuity correction is used for Kendall's tau and Spearman's rho when not computed exactly (Default: TRUE).

digits

Decides the number of decimal digits to be added into the plot (Default: 2).

sig.level

Significance level (Dafault: 0.05). If the p-value in p-mat is bigger than sig.level, then the correspondi#' ng correlation coefficient is regarded as insignificant.

hc.order

Logical value. If TRUE, correlation matrix will be hc.ordered using hclust function (Default is FALSE).

hc.method

The agglomeration method to be used in hclust (see ?hclust).

lab

Logical value. If TRUE, correlation coefficient values will be displayed in the plot.

colors

A vector of 3 colors for low, mid, and high correlation values.

outline.color

The outline color of square or circle. Default value is "gray".

ggtheme

A function, ggplot2 theme name. Default value is theme_minimal. Allowed values are the official ggplot2 themes including theme_gray, theme_bw, theme_minimal, theme_classic, theme_void, etc.

title

The text for the plot title.

subtitle

The text for the plot subtitle.

caption

The text for the plot caption. If not specified (if it is NULL, i.e.), a default caption will be shown.

caption.default

Logical decides whether the default caption should be shown.

lab_col

Color to be used for the correlation coefficient labels (applicable only when lab = TRUE).

lab_size

Size to be used for the correlation coefficient labels (applicable only when lab = TRUE).

insig

Character used to show specialized insignificant correlation coefficients ("pch" (default) or "blank"). If "blank", the corresponding glyphs will be removed; if "pch" is used, characters (see ?pch for details) will be added on the corresponding glyphs.

pch

Decides the glyphs to be used for insignificant correlation coefficients (only valid when insig = "pch"). Default value is pch = 4.

pch.col, pch.cex

The color and the cex (size) of pch (only valid when insig = "pch"). Defaults are pch.col = "blue" and pch.cex = 10.

tl.cex, tl.col, tl.srt

The size, the color, and the string rotation of text label (variable names).

##### Value

Correlation matrix plot or correlation coefficient matrix or matrix of p-values.

• ggcorrmat
##### Examples
# NOT RUN {
# to get the correlalogram
ggstatsplot::ggcorrmat(
data = datasets::iris,
cor.vars = c(Sepal.Length:Petal.Width)
)

# to get the correlation matrix
ggstatsplot::ggcorrmat(
data = datasets::iris,
cor.vars = c(Sepal.Length:Petal.Width),
output = "correlations"
)

# setting output = "p-values" will return the p-value matrix

# modifying few elements of the correlation matrix by changing function defaults
ggstatsplot::ggcorrmat(
data = datasets::iris,
cor.vars = c(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width),
sig.level = 0.01,
ggtheme = ggplot2::theme_gray,
hc.order = TRUE, type = "lower", outline.col = "white",
title = "Dataset: Iris"
)

# }

Documentation reproduced from package ggstatsplot, version 0.0.2, License: GPL-3 | file LICENSE

### Community examples

Looks like there are no examples yet.