Skip to contents

apa7 0.3.0

Changes that can affect existing tables

These change the output of code that worked with apa7 0.2.0.

  • table_width works the same way in every function that takes it (apa_flextable(), apa_style(), apa_cor(), apa_chisq(), and pretty_widths()): a proportion of the page width from 0 to 1, the name of a width ("page", "landscape", or "column"), or a named number (e.g., c(landscape = .8) or c(cm = 10)). Its default, NULL, is the new table_width setting of apa7_defaults() (1, the full width of the page, unless changed). This changes three functions:
    • apa_cor(): table_width was a width in inches.
    • pretty_widths(): table_width was a width in unit, with NULL for the page width.
    • apa_style(): table_width defaulted to 0 (only as wide as the contents); use table_width = 0 for that.
    A number greater than 1 is still read as inches (or in unit in pretty_widths()), with a warning to write it with its unit (e.g., c(inches = 5)), and a table wider than its page fills the page. In apa_cor(), the table’s width now matches table_width: before, the number column’s adjustment made the table wider than requested (e.g., 6.71 rather than 6.5 inches), and very narrow tables could get a Variable column of negative width.
  • The accuracy setting now changes the number of decimals in tables. Before, the default column formats kept the accuracy they had when apa7 was loaded, so apa7_defaults(accuracy = .001) did not change the decimals of most tables. Setting column_formats without accuracy in apa7_defaults() makes the formats’ own accuracy the accuracy setting.
  • apa_parameters() introduces the fixed and random effects of mixed models (lme4, glmmTMB, and nlme) with “Fixed effects” and “Random effects” heading rows, as parameters::model_parameters() does. Use effect_headings = FALSE to leave them out. The random-effects heading names the statistic of the SD rows (e.g., “Random effects (SD)”), and each cluster (grouping factor) gets a subheading with its terms indented below it, so cluster names are not repeated on every row. Correlations name their own statistic (e.g., “r (Constant, Days)”), and nested clusters are spelled out (e.g., “Classroom in School”).
  • apa_cor() passes its other arguments to correlation::correlation() rather than psych::corTest(). adjust is still accepted as p_adjust, and use = "complete" removes incomplete rows, each with a warning.
  • apa_chisq() has been rewritten to work like the other table functions. It returns a tibble (an apa7_tbl) that is displayed as an APA-style table in documents, and apa_note() writes its note instead of the footer it added itself.
    • The variables are chosen with variable (the rows) and by (the columns), unquoted or quoted. A data frame with exactly two columns still works without them: the first column gives the columns of the table, and the second gives its rows, as before.
    • percent shows percentages of each column ("column", the default, as before), of each row ("row"), or of the whole sample ("total"), or counts only ("none"), with percent_digits decimals. total = TRUE (default) adds a “Total” row and column.
    • test chooses the chi-square test of independence ("chisq", default), Fisher’s exact test ("fisher"), or no test ("none"). 2 × 2 tables use Yates’s continuity correction unless correct = FALSE, and the note says so. When an expected count is below 5, the note says that the chi-square approximation may be inaccurate.
    • The effect size is φ for 2 × 2 tables and Cramér’s V otherwise (effect_size). Before, it was the adjusted Cramér’s V (labeled “Adj. Cramer’s V”) for every table.
    • The note gives the number of cases left out because of missing values, and labels names the variables.
    • The arguments that styled the flextable (e.g., note, font_size, and table_width) and suppress_warnings are deprecated. If any is given, a flextable is returned as before, with a warning. Pass the table to apa_flextable() instead, with note = TRUE for the note.
  • column_formats() takes variable labels as labels, named by the variables (e.g., c(parental_income = "Parental Income")), as apa_descriptives() and apa_chisq() do. variable_labels, which was named by the labels, still works, with a warning. Both are reserved for a future version, in which they will be the default labels of every table function; no table function uses them yet. Its intercept_text and starred_columns arguments, which no function ever used, are deprecated: set the intercept label with apa7_defaults(intercept_text = ) and stars with each table function’s starred.
  • apa_cor() returns a tibble (an apa7_tbl) that is displayed as an APA-style table in documents, like the other table functions, and apa_note() writes its note. Before, it returned a flextable with the note below it.
    • With apaquarto, use #| apa-note: !expr apa7::apa_note(tbl). Otherwise, use apa_flextable(tbl, note = TRUE), which lays out the table as before: numbered variables under a “Variable” header, correlation columns of equal width, and centered summary columns.
    • The probability note is now part of the note’s paragraph, ending with a period, rather than a paragraph of its own.
    • The arguments that styled the flextable (note, font_family, font_size, text_color, border_color, border_width, line_spacing, and table_width) and output are deprecated. If any is given, a flextable is returned as before (or the table, for output = "tibble"), with a warning. Pass the table to apa_flextable(), which takes the same arguments, instead.
    • column_formats now formats the summary columns. Before, it was ignored.
  • Tables of lists of models from apa_parameters() put the model comparison statistics (e.g., R2 and ΔR2) in rows below each model’s parameters (and random effects), as in many hierarchical regression tables, rather than in columns. This makes room for more statistics without widening the table. Use performance_layout = "columns" for the earlier layout. In both layouts, the first model has no change statistics (before, lists of GAMs showed its R2 as its change). In rows, each kind of model has its own default statistics: its fit (e.g., R2 and ΔR2 for linear models, a pseudo-R2 for GLMs, and the marginal and conditional R2 for mixed models), the test of the change with its degrees of freedom in the label (e.g., F(1, 29) or χ2(2)), and AIC where it helps. The stars are on the test, which tests the first model against a model with only a constant (and the random effects of mixed models), as in hierarchical regression tables. The columns layout keeps its defaults.
  • Three arguments were renamed so that the same idea has the same name everywhere. The old names still work, with a warning:
    • apa_cor(p_value = ) is now alpha, as in p2stars() and add_star_column().
    • apa_p_star_note(x = ) is now alpha.
    • add_break_columns(d = ) is now data, as in the other functions.
  • Some models that inherit from a supported class get their own tables instead of the parent’s, which did not fit them: MASS::rlm models got an lm table (with an ordinary-least-squares β and nothing saying the fit was robust), geepack::geeglm models got a GLM table (without a test statistic, and with likelihood ratio tests and AIC in lists), and manova() models got an aov table. Conditional logistic (survival::clogit), tobit (AER::tobit), and survey-weighted (survey::svyglm) models, which would get Cox, parametric survival, or GLM tables with the wrong labels and notes, now give an error. See “New models” below.
  • Notes say p ≤ .05 (and ≤ .01 and ≤ .001) where they explain stars or bold, matching the values that are marked: a p-value equal to a threshold has always been starred or bolded, but star notes (from apa_p_star_note() and apa_cor()), apa_cor()’s bold note, and Johnson–Neyman sentences said p < .05.
  • apa_note() gives the sample size of every model table (e.g., “N = 32.”), including lm, glm, ordinal, and multinomial models, so notes that were empty now have a sentence, and apa_flextable(note = TRUE) always adds a note to these tables. Mixed models give the number of clusters of each grouping factor (e.g., “N = 180 observations (Subject: 18 clusters).”). Lists of models give N once when the models share it.
  • apa_note() puts non-breaking spaces (U+00A0) around comparison signs (=, <, >, ≤, ≥, ≠, ≈), so that “N = 32” or “p ≤ .05” never breaks across lines. Code that searches note text for " = " should search for "\u00A0=\u00A0" instead.
  • Table notes are now single-spaced, even when the table is double-spaced. This applies to apa_flextable(note = TRUE), apa_cor(), apa_chisq(), and footers styled by apa_style(). line_spacing now sets only the spacing of the header and body.

New table functions

  • New apa_descriptives() makes descriptive statistics tables (“Table 1”): M (SD) or Mdn (IQR) for continuous variables and n (%) for categorical variables, with a column for each group of by and for the whole sample, and optional tests of group differences (test = "auto", "chisq", or "fisher"). apa_note() says which statistics are shown and lists missing values.
  • apa_descriptives() uses Fisher’s exact test instead of the chi-square test for a categorical variable whose table has an expected count below 5, and the note names those variables (test = "chisq" or "fisher" chooses one test for all). New missing = "row" shows the missing values of each variable in a “Missing” row instead of the note, and range = TRUE adds a “Range” row (minimum and maximum) below each continuous variable.
  • New apa_reliability() makes reliability and item analysis tables: for each item, M, SD, the corrected item–total correlation, and Cronbach’s α if deleted, followed for each scale by the scale mean and SD, α with a confidence interval, McDonald’s ωtotal, and the mean inter-item correlation. It handles several scales, reverse-keyed items, and items scored 0 or 1 (difficulty and KR-20), and level = "scales" gives one row per scale. flag = .30 bolds item–total correlations below .30 and values of α if deleted above the scale’s α, as flag bolds large VIFs in apa_collinearity().
  • apa_descriptives() selects variables, by, and categorical, and apa_reliability() selects the items in scales and reverse, with unquoted or quoted names or tidyselect helpers (e.g., variables = c(age, starts_with("item")), by = group or scales = list(Anxiety = anx1:anx5), reverse = c(anx2, anx4)).
  • New apa_means(), apa_contrasts(), and apa_slopes() make tables of estimated marginal means, contrasts (e.g., pairwise comparisons after an ANOVA), and simple slopes (e.g., to probe a moderation effect) from modelbased::estimate_means(), estimate_contrasts(), and estimate_slopes(). They take a model (with the modelbased arguments, such as by, contrast, trend, and p_adjust) or the modelbased output. Other variables in by get heading rows, probabilities from logistic models have no leading zero, and apa_note() says what the values are, how the other predictors were held constant, on which scale the estimates are, which level was subtracted from which, and how p-values were adjusted for multiple comparisons. Moderator values set with a modelbased shortcut are named (e.g., by = "x=[sd]" gives “−1SD (12.23)”, “M (14.23)”, and “+1SD (16.23)”, and "x=[fivenum]" gives the minimum, quartiles, median, and maximum), contrasts between such values (contrast = "x=[sd]") are labeled by name (e.g., “+1SD − M”), and a numeric variable named in by without values (by = "x") is set to its mean and 1 SD above and below it rather than to the 10 values that modelbased uses by default. by, contrast (in apa_contrasts()), and trend (in apa_slopes()) are named arguments, and their variable names can be quoted or unquoted (e.g., apa_contrasts(fit, contrast = cyl, by = am)). Models with variable names that are not syntactic (e.g., `Partner Status`), for which marginaleffects gives standard errors of 0 or NA, are refit with syntactic names, and the tables keep the original names.
  • apa_contrasts() adds Cohen’s d with its confidence interval for models of continuous outcomes with an identity link (e.g., lm() and aov()): each difference divided by the model’s residual standard deviation, with an interval that accounts for the uncertainty in that standard deviation (as in emmeans::eff_size()). For mixed models, give the standard deviation with sd. effect_size = FALSE leaves d out, and apa_note() says how it was computed.
  • The note of apa_slopes() gives the Johnson–Neyman intervals (Johnson & Neyman, 1936) when the slope depends on a single continuous moderator through a two-way interaction: the values of the moderator, within its observed range, at which the slope is significant. The boundaries are computed exactly from the coefficients and their covariance matrix, rather than from a grid of moderator values. johnson_neyman = FALSE leaves them out.
  • New apa_n_factors() makes a factor retention table from parameters::n_factors(): each method (e.g., parallel analysis, Velicer’s minimum average partial test, and the Kaiser criterion) with the number of factors it suggests, the numbers supported by the most methods bolded, and method names spelled out. With table = "agreement", each suggested number of factors gets a row with the number of methods that suggest it and the cumulative variance explained. It can run parameters::n_factors() on a data frame or format its output, and apa_note() names the number of factors supported by the most methods.
  • New apa_collinearity() makes tables of collinearity diagnostics from performance::check_collinearity(): the variance inflation factor (VIF) of each predictor with its confidence interval, and tolerance (or the standard-error inflation factor and the tolerance interval). Terms with more than 1 df get generalized VIFs, models with several parts (e.g., zero-inflated models) get a heading for each part, and flag = 10 (or 5) bolds large VIFs. apa_note() names the terms with generalized VIFs, explains the VIFs of interaction terms, and defines tolerance.
  • New apa_htest() runs t tests (Welch’s or Student’s, two-group or one-sample), Wilcoxon rank-sum and signed-rank tests, correlation tests (Pearson, Spearman, or Kendall), and chi-square tests of independence on the variables in a data frame, and makes a table with one row per outcome (e.g., apa_htest(d, mpg + hp ~ am)). It shows group means and standard deviations (or medians) under group spanners, the test statistic, df, p, and an effect size with a two-sided confidence interval: Cohen’s d or Hedges’ g, the rank-biserial correlation, or Cramér’s V, φ, or Cohen’s w. Effect sizes are computed from the data, so they do not depend on where the function is called, and Cohen’s d for Welch’s test is exact rather than approximated from t. apa_note() says which tests were done, how d was standardized, and what the abbreviations stand for.
  • apa_htest() runs paired t tests and Wilcoxon signed-rank tests of paired variables with Pair() in the formula (e.g., apa_htest(d, Pair(pre, post) ~ 1), or several pairs joined with +). Paired t tests show dav by default, which is comparable to d for independent groups; dz, drm, and Hedges’ g versions come from effectsize::repeated_measures_d(). New pair_labels argument sets the headings above each pair’s descriptive statistics.
  • apa_htest() accepts test results already computed: an htest object from t.test(), wilcox.test(), cor.test(), or chisq.test(), or a list of them. Effect sizes are computed from what the objects keep (exactly for one-sample and paired t tests and for chi-square tests of independence, and approximately for two-sample t tests), and apa_note() says how.
  • New apa_subgroups() makes a table of a subgroup analysis of a meta-analysis fit with metafor::rma(): each subgroup’s k, pooled estimate, confidence interval, p, and I2, followed by the overall estimate. By default, each subgroup has its own τ2 and the subgroups are compared with Qbetween; with tau2 = "common", the estimates and the test (QM, or F with the Knapp–Hartung adjustment) come from a meta-regression with the subgroup as a moderator. apa_note() describes the model and gives the test of subgroup differences.
  • New apa_publication_bias() makes a table of tests and corrections for publication bias in meta-analyses fit with metafor::rma(): Egger’s regression test with its limit estimate, Begg and Mazumdar’s rank correlation test, trim and fill with the number of imputed studies and the adjusted estimate, and (optionally) the fail-safe N. Adjusted estimates are on the same scale as in apa_parameters(), and apa_note() gives the unadjusted pooled estimate and describes each method.

New models

  • apa_anova() makes F tables of the fixed effects of linear mixed models from lme4::lmer() or lmerTest::lmer(), and formats ANOVA tables from lmerTest’s anova(). Tests come from lmerTest, with Kenward-Roger (default, as in apa_parameters()) or Satterthwaite (ddf = "Satterthwaite") denominator degrees of freedom, and are Type III by default. The table shows dfeffect, dferror, F, and p. Partial effect sizes, computed from F and its degrees of freedom, are shown only when requested (e.g., effect_size = "eta"). apa_note() gives the type of tests, the degrees-of-freedom method, and how the effect size was computed.
  • apa_anova() makes tables of multivariate analyses of variance from manova(), from lm() with several outcomes (lm(cbind(y1, y2) ~ x)), and from car::Anova() tables of such models. Each effect has its multivariate statistic (Pillai’s trace by default; test = "Wilks", "Hotelling-Lawley", or "Roy"), its approximate F test with df1 and df2, and partial η2 computed from the approximate F. Sums of squares are sequential by default, and type = 2 or 3 gives car::Anova() tests. univariate = TRUE shows the ANOVA of each outcome under its own heading instead. apa_note() names the statistic, the outcomes, N (when the model, rather than a car::Anova() table, is given), and the type of sums of squares. Before, manova() models were treated as aov models, and multivariate lm() models gave an error.
  • apa_parameters() and apa_performance() support multinomial logistic regression models fit with nnet::multinom(). Each outcome category gets a heading row naming its comparison with the reference category (e.g., “Part time vs. Not working”), with its coefficients indented below it (or category_headings = FALSE for labels such as “Part time: Constant”). Exponentiated coefficients are odds ratios relative to the reference category, labeled OR, and apa_note() names the reference category. apa_performance() reports McFadden’s pseudo-R2, and lists of multinomial models are compared with likelihood ratio tests.
  • apa_parameters() and apa_performance() support zero-inflated and hurdle count models fit with pscl::zeroinfl() and pscl::hurdle(). The count model and the zero model appear under their own headings (“Count model”, and “Zero-inflation model” or “Zero hurdle model”; or labels such as “Zero-inflation: Ment” with component_headings = FALSE), and only the count model’s coefficients are exponentiated (IRR). apa_note() names the count distribution, gives the negative binomial dispersion parameter, and says what the zero model’s coefficients mean. Lists of these models are compared with likelihood ratio tests.
  • apa_parameters() and apa_performance() support beta regression models fit with betareg::betareg(), for outcomes between 0 and 1 such as proportions. The mean model and the precision model (φ) are under their own headings (or labeled with component_headings = FALSE), and with a logit link, the mean model’s exponentiated coefficients are odds ratios (OR). A constant precision is shown as one φ row without a test. apa_note() names the links and gives N. apa_performance() shows betareg’s pseudo-R2 and AIC, and apa_performance_comparison() compares nested models with likelihood ratio tests.
  • apa_parameters() and apa_performance() support quantile regression models fit with quantreg::rq(). Coefficients are tested with t tests, with standard errors chosen with the new se argument (Hendricks–Koenker sandwich estimates by default), and apa_note() names the quantile and the standard errors. Models with several quantiles (e.g., tau = c(.25, .5, .75)) show each quantile’s estimates side by side under column spanners, or stacked under heading rows with quantiles = "rows". apa_performance() shows the Koenker–Machado R1 and AIC of each quantile, and lists of models are compared by R1 and AIC, without tests.
  • apa_parameters() and apa_performance() support robust regression models fit with MASS::rlm() and robustbase::lmrob(). The table has the layout of a linear regression without standardized coefficients, and apa_note() names the estimator and its weights (e.g., MM-estimation with bisquare weights), says how the standard errors were computed, and gives N and the number of cases with weights below .10. apa_performance() shows the robust R2 and residual scale of lmrob models and the robust scale of rlm models. apa_performance_comparison() compares nested lmrob models with robust Wald tests and rlm models without tests. Before, rlm models got an ordinary linear regression table, and lmrob models gave an error.
  • apa_parameters() and apa_performance() support Cox proportional hazards models fit with survival::coxph(). Coefficients are tested with z tests, and their exponentiated values are hazard ratios (HR). apa_note() names the model and gives the number of cases and of events. apa_performance() shows Nagelkerke’s pseudo-R2, the concordance index (C), and AIC, and apa_performance_comparison() compares nested models with likelihood ratio tests.
  • apa_parameters() and apa_performance() support parametric survival models fit with survival::survreg() (accelerated failure time models). Coefficients are changes in log survival time, tested with z tests, and their exponentiated values are time ratios (TR). The log of the scale parameter has its own row, tested only for Weibull models (where it tests the exponential model). apa_note() names the distribution and gives the number of cases and of events. apa_performance() shows Nagelkerke’s pseudo-R2, the concordance index (C), and AIC, and apa_performance_comparison() compares nested models with likelihood ratio tests.
  • apa_parameters() and apa_performance() support generalized additive models fit with mgcv::gam() and mgcv::bam(). The table has the parametric terms (coefficients, standard errors, and t or z tests) and the smooth terms (effective degrees of freedom and approximate F or χ2 tests) under their own headings (terms = "parametric" or "smooth" shows one kind). Smooth terms are labeled by type and variables (e.g., “s(Age)”, “te(Longitude, Latitude)”), with a row for each level of a factor-by variable, and apa_note() names the method that estimated the smoothing parameters. apa_performance() gives the adjusted R2 and the deviance explained. Lists of GAMs are compared by R2 and AIC, without nested tests, which are not well defined for penalized smooths.
  • apa_parameters() and apa_performance() support generalized estimating equations fit with geepack::geeglm(). Coefficients have geepack’s robust (sandwich) standard errors, exponentiated coefficients by link (e.g., OR), and Wald z tests, and the estimated working correlation (α) is shown below them (correlation_rows). apa_note() names the link, the working correlation, the kind of standard errors, and the numbers of observations and clusters. apa_performance() gives QIC and QICu rather than AIC or R2, and lists of models are compared by QIC with Wald tests of the added terms. Before, geeglm models were treated as GLMs: the table had no test statistic, and lists got likelihood ratio tests and AIC, which GEE models do not have.
  • apa_parameters() and apa_performance() support mixed models fit with glmmTMB::glmmTMB(). Fixed effects are tested with z tests, coefficients of log and logit links are exponentiated by default (e.g., IRR for negative binomial models), and random effects are shown as for lme4 models. Zero-inflation and dispersion parts appear under their own headings (“Zero-inflation model”, “Dispersion model”), and apa_note() gives their scale. glmmTMB models also work in lists of models and in apa_performance_comparison().
  • apa_parameters() and apa_performance() support linear mixed models fit with nlme::lme(). Fixed effects are tested with t tests using nlme’s degrees of freedom, random effects are shown as for lme4 models, and parameters of residual correlation structures (e.g., corAR1()) and variance functions (e.g., varIdent()) are shown below the residual SD. apa_note() names the structures and says how the degrees of freedom were computed. lme models also work in lists of models and in apa_performance_comparison().
  • apa_parameters() and apa_performance() support ordinal mixed models (cumulative link mixed models fit with ordinal::clmm()). The predictors and thresholds are displayed as for ordinal::clm() models (Wald z tests, cumulative odds ratios for logit links, and untested thresholds), and the random effects as for lme4 models. apa_performance() shows the marginal and conditional R2 and AIC, and apa_performance_comparison() compares nested models with likelihood ratio tests.
  • apa_performance() makes fit-index tables for lavaan models (e.g., from lavaan::cfa() and lavaan::sem()): the model χ2 test, CFI, TLI, RMSEA with its 90% confidence interval, and SRMR (or any of these plus AIC and BIC). Models fit with robust estimators (e.g., MLR or WLSMV) show the scaled χ2 test and robust (or scaled) indices. apa_note() gives the sample size, the estimator, and how missing data were handled, and defines the abbreviations. Lists of lavaan models give one row per model.
  • apa_parameters() makes parameter tables for lavaan models. Fully standardized estimates (β) with their standard errors and p-values are shown by default (standardize = FALSE for unstandardized estimates), under headings for factor loadings (e.g., Visual → x1), regressions (e.g., Speed ← Visual), correlations (e.g., Visual ↔︎ Textual), and defined parameters such as indirect effects. Variances, intercepts, and thresholds can be added. Parameters fixed to set the scale are not tested, and apa_note() names them, along with the estimator, the standardization, and robust or bootstrap standard errors.
  • apa_parameters() supports multiple-group lavaan models. The groups are shown side by side under column spanners (or stacked under group headings with groups = "rows"), and apa_note() gives each group’s size and names the parameters constrained to be equal across groups.
  • apa_loadings() and apa_factor_cor() accept lavaan models. The loading matrix shows the fully standardized loadings, sorted as for exploratory analyses, with loadings fixed at 0 left blank (cross-loadings are shown), and the factor correlation table shows the standardized latent correlations. apa_note() gives the sample size and the estimator.
  • apa_performance_comparison() compares nested lavaan models (e.g., the configural, metric, and scalar models of a measurement invariance analysis), each with the one before it. Each row shows the model’s fit and, under a “Change from previous model” spanner, the χ2 difference test from lavaan::lavTestLRT() (scaled for robust estimators) and the changes in CFI and RMSEA (or TLI and SRMR). apa_note() names the difference test.
  • apa_cor() computes its correlations with correlation::correlation() (now imported) rather than psych::corTest(), so the table can show Spearman, Kendall, robust, partial, or multilevel correlations with the new method, p_adjust, and partial arguments, and other arguments are passed to correlation::correlation(). The defaults (Pearson correlations, pairwise deletion, and unadjusted p-values) give the same tables as before. Variable names with spaces work for every kind of correlation, because apa_cor() uses internal names while computing them. apa_cor() also accepts the output of correlation::correlation(). The note says what kind of correlations are shown and how the p-values were adjusted for multiple comparisons.
  • apa_parameters() and apa_performance() support meta-analyses fit with metafor::rma(). For models without moderators, apa_parameters() shows each study’s effect size, confidence interval, and percentage of the total weight, followed by the pooled estimate under a rule. The effect-size column is named by the measure (e.g., g, r, or RR); ratios are exponentiated, and Fisher’s z values are converted back to correlations (transform = FALSE keeps the analysis scale). Meta-regressions get a coefficient table, with exponentiated coefficients for ratio measures. apa_performance() gives k, Q, τ2, I2 (and τ, H2, and confidence intervals), and, for meta-regressions, the test of the moderators and R2. apa_note() names the measure and the model (including the estimator of τ2 and the Knapp–Hartung adjustment) and gives the test of the pooled estimate, its prediction interval, and the test of heterogeneity. Multilevel meta-analyses fit with metafor::rma.mv() (random intercepts at one or more nested levels, e.g., effect sizes in studies) get the same tables, with each level’s variance component (σ2) and the multilevel I2 (Cheung, 2014). A new article describes the tables.

Table notes and citations

  • Articles cited in table notes (e.g., for trim and fill or the multilevel I2) can be resolved by citeproc and added to the reference list. apa7 comes with a BibTeX file of these references, and apa7_write_bib() copies it to a document’s folder. With the new citations argument of apa_note() (or options(apa7.citations = )), citations are written as Pandoc citation keys ("keys", e.g., [@duvalTrimFillSimple2000]) or as text ("text", e.g., “(Duval & Tweedie, 2000)”). The default, "auto", writes a key when a Quarto or R Markdown document is being rendered and its bibliography has that entry, and text otherwise, so listing the file in the document’s bibliography is enough. A bibliography set for a whole Quarto project or folder (in _quarto.yml or _metadata.yml) is found, too. References cited in notes inside flextables (from apa_flextable(note = TRUE), apa_cor(), and apa_chisq()) are added to the document’s reference list: ftExtra formats such a note on its own, so apa7 adds the keys to the document’s nocite field when the table is printed. The keys are those of Zotero’s Better BibTeX extension. Notes cite the methods they name: Kenward–Roger and Satterthwaite degrees of freedom, Greenhouse–Geisser and Huynh–Feldt corrections, generalized η2, Feldt’s confidence interval for α and McDonald’s ωtotal, the generalized VIF, paired-samples d, Holm and Benjamini–Hochberg adjustments, the DerSimonian–Laird estimator and Knapp–Hartung adjustment, the multilevel I2, publication-bias methods, the MLM and MLR estimators and scaled χ2 difference tests of lavaan, and pseudo-R2 (Tjur, Nagelkerke, McFadden, and the marginal R2 of mixed models), which notes of lists of models now define.

Settings

  • apa7_defaults() sets all of apa7’s settings in one place: new print and citations arguments set the apa7.print and apa7.citations options. Its other simple settings (accuracy, font_family, intercept_text, width_aware_padding, and page_width) are now R options, too (apa7.accuracy, apa7.font_family, apa7.intercept_text, apa7.width_aware_padding, and apa7.page_width), so they can be set with options(), including in an .Rprofile file, before apa7 is loaded. apa7_defaults() checks its values before changing anything, and it returns the previous values of the settings it changed, which do.call(apa7_defaults, old) restores (before, it returned the settings’ environment itself, which changed along with the settings). apa7_defaults(reset = TRUE) now restores the same p-value formatter that is used when apa7 is loaded.
  • New page_width setting in apa7_defaults() sets the width of the text area that tables fill: a number in inches, or the name of a paper size, whose width less APA’s 1-inch margins is used (e.g., apa7_defaults(page_width = "a4") for 6.27 inches). The paper sizes are those of Typst’s page function (e.g., "a4", "a5", "us-letter", "us-legal"). apa_flextable(), apa_cor(), and pretty_widths() use it in place of the fixed 6.5 inches (the width of letter-size paper with 1-inch margins, which is still the default).
  • Tables can be made for landscape pages and for two-column documents without changing the page width. table_width = "landscape" fills the text area of a landscape page, table_width = "column" fills one column of a two-column page, and table_width = "page" (or "portrait") fills a portrait page, in every table function. A named number gives a proportion of one of these widths (e.g., c(landscape = .8)) or a width in inches, cm, or mm (e.g., c(cm = 10)).
    • New landscape_width and column_width settings in apa7_defaults() give these widths in inches. By default, they follow page_width: the paper’s height less 1-inch margins (9 inches for letter-size paper), and the width of a column in apaquarto’s two-column journal mode (documentmode: jou), which has 0.75-inch margins and a gutter of 4% of the text width (3.36 inches for letter-size paper).
    • New table_width setting in apa7_defaults() sets the default width of tables (e.g., apa7_defaults(table_width = "column") in a two-column document). Proportions given to a table function are then proportions of that width.
    • New apa7-width chunk option (apa7.width in R Markdown) sets the width of the tables made in one code chunk, including tables printed automatically, without changing any other table (e.g., #| apa7-width: landscape, or #| apa7-width: {landscape: .8}). A table_width given to a function overrides it. A chunk with apaquarto’s apa-twocolumn: true, which spans a table across both columns of a two-column page, makes the table as wide as the page.
    • When page_width and table_width are not set with apa7_defaults(), the document being rendered supplies them: its papersize (e.g., papersize: a4) sets the paper, and apaquarto’s documentmode sets the margins (0.75 inches on each side in journal mode and 1.5 inches on the left in thesis mode). In journal mode (documentmode: jou), which sets the text in two columns, tables are as wide as a column unless a chunk or function asks for another width, and a table with apa-twocolumn: true spans both columns.
    • The Getting Started article has a new section on table widths.
  • New font_size setting in apa7_defaults() (the apa7.font_size option) sets the font size of all tables and their notes (12 points by default). apa_flextable(), apa_style(), apa_cor(), and apa_chisq() use it unless font_size is given.
  • New line_spacing setting in apa7_defaults() (the apa7.line_spacing option) sets the spacing of the headers and bodies of all tables (2, double spacing, by default; APA style also allows 1.5 or single spacing in tables). apa_flextable(), apa_style(), apa_cor(), and apa_chisq() use it unless line_spacing is given. Notes stay single-spaced.

Other improvements and bug fixes

  • apa_parameters() and apa_performance() of multivariate linear models (lm(cbind(y1, y2) ~ x)) gave an internal error and a single residual SD for all outcomes. Now apa_parameters() shows each outcome’s coefficients (B, SE, β, t, p) under a heading for each outcome, or side by side with outcomes = "columns", and the note says that they come from separate regressions. apa_performance() gives a row for each outcome with its R2, adjusted R2, and residual SD (and its overall F test with metrics = "all"). Lists of multivariate models give an error saying that they are not supported yet.
  • New performance_layout argument for lists of models in apa_parameters(): "rows" puts the model comparison metrics (e.g., R2 and ΔR2) in rows below each model’s parameters (and random effects), with their values in the first value column, as in many hierarchical regression tables. The default, "columns", keeps them in columns as before.
  • New random_scale argument for mixed models in apa_parameters(): "sd" (default) for standard deviations and correlations, or "variance" for variances and covariances. apa_note() defines the symbols.
  • apa_flextable() keeps the table width set by table_width when pretty_widths = TRUE. Before, pretty_widths() reset it to the full width, so in HTML a table could be stretched wider than its columns.
  • Decimal-aligned columns in apa_flextable() tables are centered in HTML as well as in Word.
  • Named character vectors can select columns in every argument that takes tidyselect selections (e.g., the items in scales and reverse of apa_reliability(), or variables of apa_descriptives()): the names are ignored. Before, tidyselect read them as new names and gave the error “Can’t rename variables in this context”, so a lookup vector such as c(A1 = "Am indifferent to the feelings of others") could not be used.
  • apa_performance(), apa_performance_comparison(), and apa_parameters() with a list of models no longer pass on insight’s warning about variable names quoted in backticks (e.g., `SAT-V`), which read well in tables and give the same results as other names. Other warnings are passed on as before.
  • apa_cor() centers every summary column (e.g., SD, which was off-center when its values had different numbers of digits).
  • apa_cor() lines up correlations on the decimal point when there are no star columns (star_significant = FALSE or bold_significant = TRUE), and lines up the summary columns (e.g., M, Skewness, and Kurtosis) on the decimal point.
  • apa_flextable() no longer re-formats row labels that apa_parameters() (for lme4 and glmmTMB models) and apa_htest() have already formatted. Before, random-effect labels such as “Subject: r (Constant, Days)” lost their spacing and commas in flextables.
  • apa_performance_comparison() can star more than one column (e.g., starred = c("deltaR2", "F")). Before, it gave an error.
  • apa_flextable() no longer gives the error “Tibble columns must have compatible sizes” when formatting combines or drops columns: confidence-interval bounds (CI, CI_low, and CI_high, as in the output of parameters::parameters()) or df_error beside t.
  • apa_format_columns() combines the confidence-interval columns of each column spanner (e.g., Model 1_CI, Model 1_CI_low, and Model 1_CI_high) into one interval column with its own level (e.g., “Model 1_95% CI”). Before, it gave an error. A CI column without its bounds is left as it is.
  • apa_format_columns() puts the degrees of freedom in the t header (e.g., t(28)) when it drops the df_error column. Before, the header was t, and the degrees of freedom were lost.
  • apa_flextable(note = TRUE) adds the note of tables of several models from apa_parameters(). Before, it gave an error, because the note’s information was lost along the way.
  • apa_parameters(), apa_performance(), and apa_performance_comparison() give an error for conditional logistic regression models (survival::clogit()), tobit models (AER::tobit()), and survey-weighted GLMs (survey::svyglm()), which are not supported yet. Before, they got the table of the class they inherit from (Cox models, parametric survival models, and GLMs), with labels or notes that do not fit them (e.g., hazard ratios for what are odds ratios).
  • apa_parameters() works for glmmTMB models without random effects (e.g., a beta regression with a dispersion formula). Before, it gave an error.
  • pivot_wider_name_first() uses its names_prefix, names_sep, and names_vary arguments, which it accepted but ignored. For example, names_prefix = "Model " turns names_from values 1 and 2 into the spanners “Model 1” and “Model 2”. The defaults give the same names as before.
  • header_align_vertical in apa_flextable() and apa_style() aligns the header cells of every table. Before, it applied only when the first column was named Variable or Predictor, and other headers were always top-aligned.
  • Every error, warning, and message uses cli formatting and names the function you called (e.g., apa_anova()), with hints in separate lines. When a model needs a package that is not installed (e.g., car for Type 2 and 3 sums of squares, or lavaan), rlang::check_installed() offers to install it in interactive sessions.
  • The documentation of every argument was reviewed. Descriptions that contradicted the defaults were corrected (e.g., trim_leading_zeros and add_plusses in align_chr(), inline in apa_p(), bracket in matrix_display(), type in add_list_column(), and right_tag in tagger()), and units, accepted values, and defaults were added (e.g., apa_flextable() and apa_style() sizes are in points). apa_note() lists every table function whose notes it writes, and apa_performance() lists its default metrics for each kind of model.
  • The documentation of table_width in apa_flextable(), apa_style(), and apa_chisq() now says that it is a proportion of the container’s width (from 0 to 1), not a width in pixels. A table_width that is not a valid width now gives a clear error instead of flextable’s “width is > 1”.

apa7 0.2.0 2026-10-18

CRAN release: 2026-11-21

  • New apa_anova() makes APA-style ANOVA source tables for aov and lm models (Type 1 sums of squares, or Types 2 and 3 via car::Anova()), repeated-measures aov models with Error() strata, afex models, and tables from stats::anova() and car::Anova(). Effect sizes (partial, non-partial, or generalized η2, ω2, or ε2) and their two-sided confidence intervals come from effectsize.

  • New apa_note() writes the text of a table note. For apa_parameters() tables of regression models (including lists of models and lme4 models), it says which robust standard errors were used, how mixed-model degrees of freedom were approximated, and that ordinal thresholds are not tested, and it defines the standardized coefficient, exponentiated coefficient (e.g., OR), confidence interval, and R2 change columns. For apa_loadings() and apa_factor_cor() tables, it gives the extraction method and rotation, says that oblique loadings are pattern coefficients, and explains omitted and bolded loadings and the h2, u2, and Complexity columns. For apa_anova() tables, it gives the type of sums of squares, which effects have sphericity-corrected degrees of freedom (afex models), what the effect size and MSE stand for, and what stars or bold values mean. With apaquarto, use it as #| apa-note: !expr apa7::apa_note(tbl). Without apaquarto, apa_flextable(note = TRUE) places the note below the table.

  • apa_parameters() now returns the ANOVA table for aov, repeated-measures aov, and afex models. Before, aov models were treated as lm models and gave a coefficients table.

  • apa_loadings() has been reworked:

    • It now returns an apa7_tbl, so it renders as a flextable in Quarto and R Markdown. It supports psych::principal() as well as psych::fa(), and output from parameters::factor_analysis() and parameters::principal_components() (including unrotated components from stats::prcomp()).
    • New bold_max argument bolds the largest loading in each row.
    • New factor_names argument relabels the factors.
    • New variance argument adds rows for the sum of squared loadings and the proportion and cumulative proportion of variance explained, with a rule above them.
    • New communality, digits, and format_variable_names arguments. apa_flextable() no longer reformats item text in the Variable column.
    • Small loadings are now blank strings rather than NA.
    • The unused column_formats argument has been removed.
  • New apa_factor_cor() makes a table of factor correlations from obliquely rotated psych::fa(), psych::principal(), and parameters::factor_analysis() solutions.

  • column_format() gains an abbreviation slot that says what a header stands for (e.g., "standardized coefficient" for β). apa_note() defines every abbreviated header in a table from these slots, for any table type, so setting the slot in column_formats adds or changes a definition. The default column formats define common abbreviations (e.g., CI, AIC, BIC, RMSEA, effect sizes, and R2 variants), and column_formats() gains a get_abbreviations getter. New column formats h2, u2, and Complexity set the headers of those apa_loadings() columns.

  • apa_flextable() gains a note argument: TRUE adds the note from apa_note() below the table, and a character string adds a custom note. The note does not affect column widths.

  • apa_flextable() leaves alone any columns named in a "no_format_columns" attribute of the data, and draws a rule above the row named in a "rule_above" attribute.

  • Partial η2 columns (Eta2_partial) are now headed η2p. New column formats: Sum_Squares, Mean_Square, Eta2_generalized, Omega2, Omega2_partial, Epsilon2, and Epsilon2_partial.

  • make_apaquarto() and install_apaquarto() now list missing packages separately and ask a short “Install them now?” question, so the prompt is readable in the console (e.g., R on macOS). New ask argument installs missing packages without asking when FALSE. If installation is declined, the function stops and prints the install.packages() command to run.

apa7 0.1.3 2026-05-25

CRAN release: 2026-05-26

  • Used AI (Claude) and old-fashioned effort to generate a more complete set of unit tests, fix minor bugs, and make documentation more consistent.
  • User prompted to install any missing packages when running the make_apaquarto shiny app locally.

apa7 0.1.1 2025-09-07

  • Fix align_chr so that setting format_numeric_character = FALSE works.
  • list_column gains a unite parameter that joins list and text columns.
  • add_star_column no longer add stars if the column value is missing.

apa7 0.1.0 2025-08-19

CRAN release: 2025-09-10

  • Initial Cran Release

apa7 0.0.0.9002

  • removed apaquarto installation functions

apa7 0.0.0.9001

  • Added S7 objects for automatic column formats

apa7 0.0.0.9000

  • Initial development version