nice_corrmatrix: Nice correlation matrix

View source: R/nice_corrmatrix.R

nice_corrmatrixR Documentation

Nice correlation matrix

Description

From a data.frame object it gives a correlation matrix formatted for overview

Usage

nice_corrmatrix(
  cr,
  group = NULL,
  upper = FALSE,
  lower = TRUE,
  digits = 2,
  show_r = TRUE,
  show_p = FALSE,
  show_stars = TRUE,
  show_ci = FALSE,
  numbered_columns = TRUE,
  show_descriptives = TRUE,
  labels = NULL,
  nsig_p = 0.1,
  char_nsig,
  char_autocor = "-",
  char_p10 = "✞",
  char_NA = "",
  string_ci = "{break_sign}[{ci_lower},{ci_upper}]",
  string_p = "{break_sign}(p {nice_p(p, equal_sign = TRUE)})",
  caption = NULL,
  drop_zero = TRUE,
  type = "html",
  file = NULL,
  ...
)

Arguments

cr

A data frame

group

a vector with a grouping variable or a character with a variable name. If included, calculates multilevel correlations.

upper

TRUE if upper triangle should be included.

lower

TRUE if lower triangle should be included.

digits

Round to given digit position.

show_r

TRUE if r-values should be included.

show_p

TRUE if r-values should be included.

show_stars

TRUE if stars should be included.

show_ci

If TRUE, confidence intervals are added.

labels

Character string. If "auto" labels are taken from a label attribute.

nsig_p

p level below which correlations are considered not significant.

char_nsig

Character indexing non-significant values.

char_autocor

Character for diagonal (e.g. "-" or "1.00").

char_p10

Character indexing .10 significance level.

char_NA

Character for NA values.

string_ci

Character string in glue format for confindence internvals.

string_p

Character string in glue format for p-values.

caption

Caption for an html table.

drop_zero

If TRUE, leadning zeros are dropped.

type

Character string. "df" for data-frame. "html" for html table.

file

If TRUE or a filename is provided, a file is exportet (format is defined by file ending eith html or docx).

...

Further arguments passed to the cor.test() function.

show_discriptives

If TRUE, mean and sd columns are added.

Value

A data-frame or a html table object

Examples

nice_corrmatrix(mtcars)
nice_corrmatrix(mtcars,
  show_p = TRUE,
  show_ci = TRUE,
  show_stars = FALSE,
  show_descriptives = FALSE,
  conf.level = 0.99
)
nice_corrmatrix(mtcars, group = "cyl")

jazznbass/wmisc documentation built on Oct. 29, 2024, 5:42 p.m.