Skip to contents

Produces data frame of correlations with stars standing for significance Create Correlation Table with Significance Stars

Creates a formatted correlation matrix with optional significance stars. Handles tibble inputs and provides flexible output formats.

Usage

cor_table(d, method = "spearman", star = TRUE, raw = FALSE)

Arguments

d

A data frame or tibble containing numeric variables

method

Character string indicating correlation method. One of "pearson", "kendall", or "spearman" (default)

star

Logical. If TRUE (default), adds significance stars to correlations

raw

Logical. If TRUE, returns raw correlation matrix without formatting

Value

A matrix containing formatted correlations with significance stars (if requested) or raw correlation values

Details

Significance levels: * p < 0.05, ** p < 0.01, *** p < 0.001

Examples

if (FALSE) { # \dontrun{
data <- data.frame(x = rnorm(100), y = rnorm(100), z = rnorm(100))
cor_table(data)                          # With stars
cor_table(data, star = FALSE)           # Without stars
cor_table(data, raw = TRUE)             # Raw correlations
cor_table(data, method = "pearson")     # Pearson method
} # }