The goal of apa7 is to facilitate writing documents in APA Style (7th Edition).
Installation
You can install the development version of apa7 from GitHub with:
# install.packages("remotes")
remotes::install_github("wjschne/apa7")
Tables
The package provides functions to create APA-style tables, including correlation matrices and regression tables. The tables can be formatted using the flextable
package.
# Make regression model, format parameters, and display flextable
lm(Volume ~ Girth + Height, data = trees) |>
apa_parameters() |>
apa_flextable()
# Contingency table with chi-square test of independence
d <- mtcars[, c("am", "gear")]
colnames(d) <- c("Transmission", "Gears")
d$Transmission <- factor(d$Transmission,
levels = c(0, 1),
labels = c("Automatic", "Manual"))
apa_chisq(d)