Description
APA 7th Edition Statistical Tables, Plots, and Multilevel Model Reports.
Description
Produces publication-ready statistical tables and figures formatted according to the 7th edition of the American Psychological Association (APA) style guidelines. Supports descriptive statistics, t-tests, z-tests, chi-square tests, Analysis of Variance (ANOVA), Analysis of Covariance (ANCOVA), two-way ANOVA with simple effects, Multivariate Analysis of Variance (MANOVA), robust and cluster-robust regression using Heteroscedasticity-Consistent (HC) standard errors, post-hoc pairwise comparisons, homoskedasticity and heteroscedasticity diagnostics including the Non-Constant Variance (NCV) test, proportion tests, and multilevel mixed-effects models with intraclass correlation coefficients (ICC) and model-comparison tables. Output can be directed to the console, Microsoft Word (via 'officer' and 'flextable'), or LaTeX. For APA style guidelines see American Psychological Association (2020, ISBN:978-1-4338-3216-1).
README.md
statAPA
statAPA produces publication-ready statistical tables and figures formatted according to the 7th edition of the American Psychological Association (APA) style guidelines. Output can be directed to the R console, Microsoft Word (via officer + flextable), or LaTeX.
Installation
Install the released version from CRAN:
install.packages("statAPA")
Or the development version from GitHub:
# install.packages("remotes")
remotes::install_github("causalfragility-lab/statAPA")
Functions at a glance
| Function | What it does |
|---|---|
apa_descriptives() | Descriptive statistics table (optionally by group) |
apa_t_test() | One-sample, two-sample (Welch/pooled), and paired t-tests |
apa_z_test_mean() | z-test with known population standard deviation(s) |
apa_chisq() | Chi-square test (goodness-of-fit or independence) |
apa_prop_test() | Proportion test with risk difference, risk ratio, odds ratio |
apa_anova() | One-way ANOVA/ANCOVA (Type II/III) with effect sizes |
apa_ancova() | ANCOVA with covariate validation and adjusted means |
apa_twoway_anova() | Two-way ANOVA with interaction and simple effects |
apa_manova() | MANOVA (Pillai, Wilks, Hotelling-Lawley, Roy) |
apa_posthoc() | Post-hoc pairwise comparisons (emmeans) |
apa_table() | Regression / multilevel coefficient table |
apa_robust() | Robust regression (HC or cluster-robust SEs) |
apa_hetero() | Heteroscedasticity diagnostics |
apa_homoskedasticity() | Homoskedasticity check (Breusch-Pagan, White, Levene) |
apa_multilevel() | Multilevel models: fixed/random effects, ICC, R², model comparison |
apa_plot_descriptives() | Mean ± 95% CI plot by group |
apa_plot_regression() | Fitted-line plot with confidence ribbon |
apa_plot_anova() | Estimated marginal means plot |
apa_plot_residuals() | Residual diagnostic plots |
apa_to_flextable() | Convert any result to an APA-styled flextable |
save_apa() | Save a ggplot figure at 300 dpi with APA dimensions |
theme_apa() | APA-style ggplot2 theme |
Quick example
library(statAPA)
# Descriptive statistics
apa_descriptives(mtcars, vars = c("mpg", "wt", "hp"), group = "cyl")
# t-test
apa_t_test(mtcars$mpg[mtcars$am == 0],
mtcars$mpg[mtcars$am == 1],
output = "console")
# Two-way ANOVA with simple effects
mtcars2 <- transform(mtcars, cyl = factor(cyl), gear = factor(gear))
apa_twoway_anova(mpg ~ cyl * gear, data = mtcars2,
factorA = "cyl", factorB = "gear")
# MANOVA
apa_manova(cbind(Sepal.Length, Petal.Length) ~ Species, data = iris)
# Multilevel model
library(lme4)
data(ECLS_demo)
m0 <- lmer(math ~ 1 + (1 | schid), data = ECLS_demo, REML = FALSE)
m1 <- lmer(math ~ SES + (1 | schid), data = ECLS_demo, REML = FALSE)
apa_multilevel(m0, m1, model_names = c("Null", "+ SES"))
# Export to Word
fit <- lm(mpg ~ wt + hp, data = mtcars)
apa_table(fit, output = "word", file = "regression_table.docx")
Citation
If you use statAPA in published research, please cite: Hait, S. (2026). statAPA: APA 7th Edition Statistical Tables, Plots, and Multilevel Model Reports. R package version 0.1.0. https://CRAN.R-project.org/package=statAPA
License
MIT © 2026 Subir Hait.