APA-formatted correlation table
Usage
apa_cor(
data,
note = NULL,
p_value = c(0.05, 0.01, 0.001),
digits = 2,
bold_significant = FALSE,
star_significant = TRUE,
significance_note = TRUE,
output = c("flextable", "tibble"),
font_family = NULL,
font_size = 12,
text_color = "black",
border_color = "black",
border_width = 0.5,
line_spacing = 2,
table_width = 6.5,
keep_empty_star_columns = TRUE,
summary_functions = list(M = mean, SD = stats::sd),
column_formats = NULL,
...
)
Arguments
- data
data.frame or tibble with variables to be
- note
Custom note to appear below table. (Overrides automatic note.)
- p_value
p-value needed to be flagged as significant
- digits
Number of digits for rounding
- bold_significant
bold significant correlations
- star_significant
start significant correlations
- significance_note
If TRUE, place note at bottom of table that significant correlations are bolded.
- output
output type. Can be "flextable" or "tibble"
- font_family
font family
- font_size
font size
- text_color
text color
- border_color
border color
- border_width
border width in pixels
- line_spacing
spacing between lines
- table_width
table width (in pixels, 0 for auto)
- keep_empty_star_columns
Keep remove empty star columns (Default:
TRUE
)- summary_functions
Any named list of functions that summarize data columns (e.g.,
list(Mean = mean, SD = sd)
). Can also be a character vector of function names (e.g.,c("n", "M", "SD")
). Functions available in a character vector: IQR, Interquartile Range, Kurtosis, MAD, Median Absolute Deviation, M, Mean, Med, Median, n, N, Quantile, Range, SD, Skewness, Var, Variance- column_formats
column_formats object
- ...
<
data-masking
> parameters passed to psych::corTest
Examples
apa_cor(mtcars[, c("mpg", "am", "gear", "carb")])
Variable
M
SD
1
2
3
4
1.
mpg
20.09
6.03
—
2.
am
0.41
0.50
.60
***
—
3.
gear
3.69
0.74
.48
**
.79
***
—
4.
carb
2.81
1.62
−.55
**
.06
.27
—
** p < .01. *** p < .001
apa_cor(mtcars[, c("mpg", "am", "gear", "carb")],
output = "tibble",
star_significant = FALSE)
#> # A tibble: 4 × 8
#> apa7listcolumn Variable M SD `1` `2` `3` `4`
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 1. mpg 20.09 6.03 — NA NA NA
#> 2 2. am 0.41 0.50 .60 — NA NA
#> 3 3. gear 3.69 0.74 .48 .79 — NA
#> 4 4. carb 2.81 1.62 −.55 .06 .27 —