plotcor: Create a ggplot2 Correlation Matrix

Description Usage Arguments Value Examples

View source: R/general_functions.R

Description

Create a ggplot2 Correlation Matrix

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
plotcor(
  dat,
  Variables_Labels = NULL,
  textadjust = 2,
  includeN = TRUE,
  reportCI = TRUE,
  low_colour = "#EDCB64",
  high_colour = "#B62A3D",
  abs_colour = TRUE,
  cluster_variables = FALSE
)

Arguments

dat

Input dataframe or matrix (*do not input a correlation matrix*).

Variables_Labels

Character vector of variable Labels, corresponding to each column in dat. If missing (NULL) then colnames(dat) will be used.

textadjust

Scalar. Adjust text size by a magnification factor.

includeN

Logical. Include sample size on upper diagononal (TRUE) or leave blank (FALSE).

reportCI

Logical. Include confidence interval on upper diagonal (TRUE) or leave blank (FALSE).

low_colour

Logical. Hex colour code for the lowest correlation.

high_colour

Logical. Hex colour code for the highest correlation.

abs_colour

Logical. If TRUE, will use the absolute correlation (i.e. ignoring whether the correlation is positive or negative) for determining square colour.

Value

ggplot

Examples

1
2
3
4
5
X = sapply(1:10, function(i) rnorm(100))
X = as.data.frame(X)
My_Labels = c(paste0("Predictor ",1:5), paste0("Outcome ",1:5))

plotcor(X, Variables_Labels = My_Labels, includeN = TRUE, reportCI = FALSE)

giac01/ccatools documentation built on July 15, 2021, 4:33 a.m.