Create a correlogram from a given dataframe

create_correlogram(
  df,
  diagonal = FALSE,
  method = "square",
  type_c = "lower",
  fig_colors = colfun()$fig10_colors
)

Arguments

df

A dataframe containing desired variables. Can be inputted as continuous, binary, or ordinal variables. Note: Binary variables must have a value of 0 or 1. Note: Ordinal variables must be formatted as factors.

diagonal

Allows user to choose to view the correlogram with diagonal entries. Default is FALSE.

method

Allows user to modify the visualization method of the correlogram. Default is "square".

type_c

Allows user to revise the display. Default is "lower".

fig_colors

Allows the user to change the colors of the figure (defaults are provided). Must be vector of length 3, with color corresponding to strength of correlation.

Value

A correlogram.

Details

Different correlation coefficients are calculated based on the nature of the variables: For two continuous variables, the Pearson correlation coefficient is used. For two binary variables, the Phi correlation coefficient is implemented. For one binary and one continuous variable, point biserial correlation is utilized. For two ordinal variables, Spearman rank correlation is utilized. For one continuous and one ordinal variable, a modified Pearson correlation combined with the nonparametric Spearman rank correlation is used. For one binary and one ordinal variable, Glass rank biserial correlation is implemented.

Examples

create_correlogram(corr)