install.packages("apa7")Tables made with apa7 are ready for publication by default, but they are also easy to customize. In version 0.3.0, apa7 now covers most of the tables in a typical psychology paper: the sample description, the main analyses, the follow-up tests, and the psychometric evidence for the measures.
How it works
Every table follows the same pattern. Fit a model with the usual R functions, give it to an apa_*() function, and print the result. In a Quarto or R Markdown document, the result is a flextable formatted in APA style, which renders to Word, HTML, and PDF. In the console, it is a tibble, so you can filter or rearrange rows before printing. apa_flextable(note = TRUE) adds a table note that apa7 writes for you.
If you write whole papers in Quarto, apa7 works with my apaquarto extension, which formats the rest of the document in APA style.
Most examples below use the Garcia data set in the psych package, from an experiment by Garcia et al. (2010). Participants read about a woman who was denied a promotion because of sex discrimination and who either did not protest, protested as an individual, or protested on behalf of women collectively. Participants rated how much they liked her and how angry they felt toward her, and their perceptions of how pervasive sexism is were also measured.
d <- psych::Garcia
d$protest <- factor(d$protest, levels = 0:2,
labels = c("None", "Individual", "Collective"))Table 1: Describing the sample
apa_descriptives() makes the first table of most empirical papers: M (SD) for continuous variables and n (%) for categorical variables, with a column for each group. With test = "auto", it adds a test of the group differences, choosing Fisher’s exact test over the chi-square test when expected counts are small.
apa_descriptives(d, c(liking, anger, sexism), by = protest, test = "auto") |>
apa_flextable(note = TRUE, table_width = "landscape")Variable | None (n = 41) | Individual (n = 43) | Collective (n = 45) | Total (N = 129) | p |
|---|---|---|---|---|---|
Liking, M (SD) | 5.31 (1.30) | 5.83 (0.82) | 5.75 (0.94) | 5.64 (1.05) | .10 |
Anger, M (SD) | 3.07 (2.07) | 1.56 (0.93) | 1.80 (1.42) | 2.12 (1.66) | <.001 |
Sexism, M (SD) | 5.07 (0.77) | 5.24 (0.76) | 5.04 (0.82) | 5.12 (0.78) | .42 |
Note. Values are M (SD) for continuous variables. p-values are from Welch’s one-way ANOVAs (continuous variables) comparing the groups of Protest. | |||||
Regression, one model or several
apa_parameters() makes coefficient tables. Give it a named list of models, and it makes a hierarchical regression table, with R2, ΔR2, and the test of each step in rows below each model.
m1 <- lm(liking ~ sexism, data = d)
m2 <- update(m1, . ~ . + protest)
m3 <- update(m2, . ~ . + sexism:protest)
list(`Model 1` = m1, `Model 2` = m2, `Model 3` = m3) |>
apa_parameters(predictor_parameters = c("Parameter", "Coefficient", "SE", "t", "p")) |>
apa_flextable(note = TRUE)Model | Variable | B | SE | t | p |
|---|---|---|---|---|---|
Model 1 | |||||
Constant | 5.01 | 0.61 | 8.18 | <.001 | |
Sexism | 0.12 | 0.12 | 1.03 | .30 | |
R2 | .01 | ||||
F(1, 127) | 1.07 | ||||
Model 2 | |||||
Constant | 4.76 | 0.62 | 7.72 | <.001 | |
Sexism | 0.11 | 0.12 | 0.92 | .36 | |
Protest–Individual | 0.50 | 0.23 | 2.19 | .03 | |
Protest–Collective | 0.45 | 0.22 | 2.00 | .05 | |
R2 | .05 | ||||
ΔR2 | .04 | ||||
F(2, 125) | 3.15* | ||||
Model 3 | |||||
Constant | 7.71 | 1.05 | 7.32 | <.001 | |
Sexism | −0.47 | 0.21 | −2.30 | .02 | |
Protest–Individual | −4.13 | 1.50 | −2.76 | .007 | |
Protest–Collective | −3.49 | 1.41 | −2.48 | .01 | |
Sexism × Protest–Individual | 0.90 | 0.29 | 3.13 | .002 | |
Sexism × Protest–Collective | 0.78 | 0.28 | 2.83 | .005 | |
R2 | .13 | ||||
ΔR2 | .08 | ||||
F(2, 123) | 5.85** | ||||
Note. N = 129. ΔR2 = change in R2; F = test of the change in fit from the previous model (for the first model, from a model with only a constant). * p ≤ .05. ** p ≤ .01. *** p ≤ .001. | |||||
The same function works for far more than lm(). I list the supported models below.
ANOVA and what comes after it
apa_anova() makes ANOVA source tables, including repeated-measures and mixed designs, Type 2 and 3 sums of squares via the car package, and multivariate analyses of variance.
fit_aov <- aov(liking ~ protest, data = d)
apa_anova(fit_aov)Source | SS | df | MS | F | p | η2 |
|---|---|---|---|---|---|---|
Protest | 6.52 | 2 | 3.26 | 3.06 | .05 | .05 |
Error | 134.52 | 126 | 1.07 |
The ANOVA is rarely the end of the story. apa_means(), apa_contrasts(), and apa_slopes() make tables of estimated marginal means, contrasts, and simple slopes from the modelbased package. Contrasts from linear models include Cohen’s d with its confidence interval, and the note says how the p-values were adjusted.
apa_contrasts(fit_aov, contrast = protest, p_adjust = "holm") |>
apa_flextable(note = TRUE, table_width = "landscape")Protest | Difference | SE | 95% CI | d | 95% CI for d | t(126) | p |
|---|---|---|---|---|---|---|---|
Individual − None | 0.52 | 0.23 | [ 0.07, 0.96] | 0.50 | [ 0.06, 0.94] | 2.29 | .07 |
Collective − None | 0.44 | 0.22 | [ 0.00, 0.88] | 0.43 | [ 0.00, 0.86] | 1.99 | .10 |
Collective − Individual | −0.07 | 0.22 | [−0.51, 0.36] | −0.07 | [−0.49, 0.35] | −0.33 | .74 |
Note. Values are differences between estimated marginal means of Liking (the first level minus the second). d = difference divided by the residual standard deviation of the model (1.03); its confidence interval accounts for the uncertainty in the residual standard deviation. p-values are adjusted for multiple comparisons with Holm’s method (Holm, 1979). CI = confidence interval. | |||||||
To probe an interaction between two continuous variables, apa_slopes() gives the simple slopes at the mean and 1 SD above and below it, and its note gives the Johnson–Neyman interval. In this example from the psychTools package, the predictors are negative emotions about climate change and age, and the outcome is support for government action on climate change.
d_climate <- psychTools::globalWarm |>
dplyr::transmute(
Support = as.numeric(govact),
`Negative Emotions` = as.numeric(negemot),
Age = as.numeric(age)
)
fit_mod <- lm(Support ~ `Negative Emotions` * Age, data = d_climate)
apa_slopes(fit_mod, trend = `Negative Emotions`, by = Age) |>
apa_flextable(note = TRUE)Age | Slope | SE | 95% CI | t(811) | p |
|---|---|---|---|---|---|
−1SD (33.20) | 0.38 | 0.04 | [0.31, 0.46] | 10.13 | <.001 |
M (49.54) | 0.50 | 0.03 | [0.45, 0.55] | 19.81 | <.001 |
+1SD (65.87) | 0.62 | 0.03 | [0.55, 0.69] | 17.85 | <.001 |
Note. Values are simple slopes of Negative Emotions (the expected change in Support for a one-unit increase in Negative Emotions) at each value of Age. Johnson–Neyman intervals (Johnson & Neyman, 1936): the slope of Negative Emotions is significant (p ≤ .05) across the observed range of Age (17 to 87). CI = confidence interval. | |||||
Everyday hypothesis tests
apa_htest() runs t tests, Wilcoxon tests, correlation tests, and chi-square tests on several variables at once and puts them in one table with their effect sizes. Paired tests use Pair() in the formula (e.g., Pair(pre, post) ~ 1). In this example from the psychTools package, participants rated their mood after watching a sad film or a comedy.
d_film <- psychTools::affect |>
dplyr::filter(Film %in% c(1, 4)) |>
dplyr::transmute(
Film = factor(Film, levels = c(1, 4), labels = c("Sad", "Comedy")),
`Positive Affect` = PA2,
`Negative Affect` = NA2,
`Tense Arousal` = TA2
)
apa_htest(d_film, `Positive Affect` + `Negative Affect` + `Tense Arousal` ~ Film) |>
apa_flextable(note = TRUE, table_width = "landscape")Variable | Sad | Comedy | t | df | p | Cohen’s d | 95% CI | |||
|---|---|---|---|---|---|---|---|---|---|---|
M | SD | M | SD | |||||||
Positive Affect | 7.27 | 5.93 | 11.75 | 6.31 | −4.74 | 164.57 | <.001 | −0.73 | [−1.05, −0.42] | |
Negative Affect | 8.67 | 5.35 | 1.79 | 2.88 | 10.32 | 125.57 | <.001 | 1.60 | [ 1.24, 1.96] | |
Tense Arousal | 17.48 | 4.74 | 13.74 | 3.14 | 6.00 | 142.09 | <.001 | 0.93 | [ 0.61, 1.25] | |
Note. Welch’s t tests compare the groups of Film without assuming equal variances. Cohen’s d uses the average of the two groups’ variances. CI = confidence interval for Cohen’s d. | ||||||||||
Psychometrics
Several new functions report the evidence for a measure’s reliability and structure. apa_reliability() makes reliability and item analysis tables, with α and ω for each scale.
apa_reliability(
psych::bfi,
scales = list(
Agreeableness = A1:A5,
Conscientiousness = C1:C5,
Extraversion = E1:E5,
Neuroticism = N1:N5,
Openness = O1:O5
),
reverse = c(A1, C4, C5, E1, E2, O2, O5),
level = "scales"
) |>
apa_flextable(note = TRUE)Scale | k | M | SD | α | 95% CI | ωtotal | Mean r |
|---|---|---|---|---|---|---|---|
Agreeableness | 5 | 4.64 | 0.90 | .70 | [.69, .72] | .72 | .33 |
Conscientiousness | 5 | 4.26 | 0.95 | .73 | [.71, .75] | .73 | .35 |
Extraversion | 5 | 4.14 | 1.06 | .76 | [.75, .77] | .76 | .39 |
Neuroticism | 5 | 3.16 | 1.19 | .81 | [.80, .82] | .82 | .47 |
Openness | 5 | 4.59 | 0.81 | .60 | [.58, .63] | .62 | .24 |
Note. Each scale uses the respondents with complete responses on its items (Agreeableness: n = 2,709; Conscientiousness: n = 2,707; Extraversion: n = 2,713; Neuroticism: n = 2,694; Openness: n = 2,726). Reverse-keyed items were reverse-scored. Scale scores are the means of the items. α = Cronbach’s α; CI = 95% confidence interval (Feldt et al., 1987); ωtotal = McDonald’s ωtotal (McDonald, 1999) from a one-factor model; k = number of items; Mean r = mean inter-item correlation. | |||||||
For exploratory factor analysis, apa_n_factors() shows how many factors each retention method suggests, apa_loadings() makes the loading matrix, and apa_factor_cor() makes the table of factor correlations. Here are the loadings of the Big Five items, with each item’s text in place of its code, small loadings hidden, and each item’s largest loading in bold.
Show the code that replaces item codes with item text
item_text <- psych::bfi.dictionary |>
tibble::rownames_to_column("code") |>
dplyr::filter(code %in% colnames(psych::bfi)[1:25]) |>
dplyr::mutate(Item = sub("[.]$", "", Item)) |>
dplyr::select(Item, code) |>
tibble::deframe()
d_bfi <- psych::bfi |>
dplyr::select(A1:O5) |>
dplyr::rename(dplyr::all_of(item_text))fit_bfi <- psych::fa(d_bfi, nfactors = 5, fm = "pa")
apa_loadings(
fit_bfi,
factor_names = c("Neuroticism", "Extraversion", "Conscientiousness",
"Agreeableness", "Openness"),
format_variable_names = FALSE,
min_loading = .30,
bold_max = TRUE
) |>
apa_flextable(note = TRUE, table_width = "landscape")Variable | Neuroticism | Extraversion | Conscientiousness | Agreeableness | Openness |
|---|---|---|---|---|---|
Get angry easily | .81 | ||||
Get irritated easily | .78 | ||||
Have frequent mood swings | .71 | ||||
Panic easily | .49 | ||||
Often feel blue | .47 | −.39 | |||
Find it difficult to approach others | −.68 | ||||
Make friends easily | .59 | ||||
Don’t talk a lot | −.56 | ||||
Take charge | .42 | ||||
Know how to captivate people | .42 | ||||
Continue until everything is perfect | .67 | ||||
Do things in a half-way manner | −.61 | ||||
Do things according to a plan | .57 | ||||
Waste my time | −.55 | ||||
Am exacting in my work | .55 | ||||
Know how to comfort others | .66 | ||||
Inquire about others’ well-being | .64 | ||||
Make people feel at ease | .53 | ||||
Love children | .43 | ||||
Am indifferent to the feelings of others | −.41 | ||||
Carry the conversation to a higher level | .61 | ||||
Will not probe deeply into a subject | −.54 | ||||
Am full of ideas | .51 | ||||
Avoid difficult reading material | −.46 | ||||
Spend time reflecting on things | −.32 | .37 | |||
Note. Principal axis factoring with oblimin rotation. Loadings are pattern coefficients. Loadings smaller than .30 in absolute value are omitted. The largest loading for each variable is in bold. | |||||
For confirmatory factor analysis and structural equation models, apa7 now works with lavaan. apa_parameters() makes tables of standardized loadings, paths, and correlations, apa_performance() makes tables of fit indices, and apa_performance_comparison() compares nested models, such as the steps of a measurement invariance analysis.
library(lavaan)
model <- "
Visual =~ x1 + x2 + x3
Textual =~ x4 + x5 + x6
Speed =~ x7 + x8 + x9
"
fit_configural <- cfa(model, data = HolzingerSwineford1939, group = "school")
fit_metric <- cfa(model, data = HolzingerSwineford1939, group = "school",
group.equal = "loadings")
fit_scalar <- cfa(model, data = HolzingerSwineford1939, group = "school",
group.equal = c("loadings", "intercepts"))
apa_performance_comparison(
Configural = fit_configural,
Metric = fit_metric,
Scalar = fit_scalar
) |>
apa_flextable(note = TRUE, table_width = "landscape")Model | χ2 | df | CFI | RMSEA | 90% CI | SRMR | Change from previous model | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Δχ2 | Δdf | p | ΔCFI | ΔRMSEA | |||||||
Configural | 115.85 | 48 | .92 | .10 | [.07, .12] | .07 | |||||
Metric | 124.04 | 54 | .92 | .09 | [.07, .11] | .07 | 8.19 | 6 | .22 | −.002 | −.004 |
Scalar | 164.10 | 60 | .88 | .11 | [.09, .13] | .08 | 40.06 | 6 | <.001 | −.038 | .015 |
Note. N = 301. Estimation used maximum likelihood (ML). CFI = comparative fit index; RMSEA = root mean square error of approximation; CI = confidence interval for RMSEA; SRMR = standardized root mean square residual. Δ = change from the previous model. Δχ2 is a likelihood ratio (χ2 difference) test. | |||||||||||
Notes that write themselves
Writing table notes is tedious, and they are easy to get wrong when an analysis changes. apa_note(), which apa_flextable(note = TRUE) calls, writes the note from the analysis itself. Depending on the table, the note gives the sample size, defines every abbreviation in the headers, names the robust standard errors, the degrees-of-freedom approximation, or the estimator, says how p-values were adjusted, and explains how the values were computed. You can use the note as is, add to it, or take it apart sentence by sentence.
Some notes cite the article that describes a method, as the notes for the contrasts and simple slopes above do. apa7 comes with a BibTeX file of these references. Write it to your document’s folder with apa7_write_bib() and list it in the YAML header, and the citations in the notes are formatted and added to the reference list, as in this post:
apa7_write_bib("apa7.bib")bibliography: [references.bib, apa7.bib]What else is supported
apa_parameters() and apa_performance() work with these kinds of models, in addition to linear and logistic regression:
| Kind of model | Packages and functions |
|---|---|
| Generalized linear models | glm() (including Poisson and negative binomial), ordinal regression with MASS::polr() and ordinal::clm() |
| Multinomial logistic regression | nnet::multinom() |
| Zero-inflated and hurdle models | pscl::zeroinfl(), pscl::hurdle() |
| Beta regression | betareg::betareg() |
| Quantile and robust regression | quantreg::rq(), MASS::rlm(), robustbase::lmrob() |
| Survival models | survival::coxph(), survival::survreg() |
| Mixed models | lme4::lmer(), lme4::glmer(), glmmTMB::glmmTMB(), nlme::lme(), ordinal::clmm() |
| Generalized additive models | mgcv::gam(), mgcv::bam() |
| Generalized estimating equations | geepack::geeglm() |
| Multivariate regression | lm(cbind(y1, y2) ~ x) |
| Structural equation models | lavaan::cfa(), lavaan::sem(), including multiple groups |
| Meta-analysis | metafor::rma(), metafor::rma.mv() |
There are also tables for collinearity diagnostics (apa_collinearity()), and for subgroup analyses and publication bias in meta-analyses (apa_subgroups() and apa_publication_bias()). apa_cor() can now show Spearman, Kendall, robust, partial, and multilevel correlations.
Fitting tables to the page
apa7_defaults() sets all of apa7’s settings in one place. Tables fill the text area of the page, which apa7 reads from the document’s paper size (e.g., A4 or US letter), and tables can fill a landscape page or one column of a two-column page. For example, the chunk option #| apa7-width: landscape widens the tables of a single chunk. The font size and line spacing of all tables can be set, too.
apa7_defaults(page_width = "a4", font_size = 11, line_spacing = 1.5)Upgrading from version 0.1
A few changes can make existing tables look different:
- Tables of lists of models put the model comparison statistics in rows below each model rather than in columns. Use
performance_layout = "columns"for the earlier layout. - Notes put non-breaking spaces around equals signs and other comparison signs (e.g., N = 129), so that an equation is never split across lines.
apa_loadings()returns a table that renders as a flextable, and small loadings are blank rather thanNA.
The NEWS page lists every change.
Learn more
The apa7 website has an article for each kind of table, with many more options than I could show here. If something doesn’t work the way you expect, or a table you need is missing, please open an issue on GitHub or email me at schneider@temple.edu.
References
Citation
@misc{schneider2026,
author = {Schneider, W. Joel},
title = {Apa7 0.3.0: {Publication-Ready} {Tables} in {APA} {Style}},
date = {2026-12-01},
url = {https://wjschne.github.io/posts/2026-12-01-apa7-030/},
langid = {en}
}