Changelog
Source:NEWS.md
apa7 0.3.0
Changes that can affect existing tables
These change the output of code that worked with apa7 0.2.0.
-
table_widthworks the same way in every function that takes it (apa_flextable(),apa_style(),apa_cor(),apa_chisq(), andpretty_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)orc(cm = 10)). Its default,NULL, is the newtable_widthsetting ofapa7_defaults()(1, the full width of the page, unless changed). This changes three functions:-
apa_cor():table_widthwas a width in inches. -
pretty_widths():table_widthwas a width inunit, withNULLfor the page width. -
apa_style():table_widthdefaulted to 0 (only as wide as the contents); usetable_width = 0for that.
unitinpretty_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. Inapa_cor(), the table’s width now matchestable_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
accuracysetting now changes the number of decimals in tables. Before, the default column formats kept the accuracy they had when apa7 was loaded, soapa7_defaults(accuracy = .001)did not change the decimals of most tables. Settingcolumn_formatswithoutaccuracyinapa7_defaults()makes the formats’ own accuracy theaccuracysetting. -
apa_parameters()introduces the fixed and random effects of mixed models (lme4,glmmTMB, andnlme) with “Fixed effects” and “Random effects” heading rows, asparameters::model_parameters()does. Useeffect_headings = FALSEto 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 tocorrelation::correlation()rather thanpsych::corTest().adjustis still accepted asp_adjust, anduse = "complete"removes incomplete rows, each with a warning. -
apa_chisq()has been rewritten to work like the other table functions. It returns a tibble (anapa7_tbl) that is displayed as an APA-style table in documents, andapa_note()writes its note instead of the footer it added itself.- The variables are chosen with
variable(the rows) andby(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. -
percentshows percentages of each column ("column", the default, as before), of each row ("row"), or of the whole sample ("total"), or counts only ("none"), withpercent_digitsdecimals.total = TRUE(default) adds a “Total” row and column. -
testchooses 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 unlesscorrect = 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
labelsnames the variables. - The arguments that styled the flextable (e.g.,
note,font_size, andtable_width) andsuppress_warningsare deprecated. If any is given, a flextable is returned as before, with a warning. Pass the table toapa_flextable()instead, withnote = TRUEfor the note.
- The variables are chosen with
-
column_formats()takes variable labels aslabels, named by the variables (e.g.,c(parental_income = "Parental Income")), asapa_descriptives()andapa_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. Itsintercept_textandstarred_columnsarguments, which no function ever used, are deprecated: set the intercept label withapa7_defaults(intercept_text = )and stars with each table function’sstarred. -
apa_cor()returns a tibble (anapa7_tbl) that is displayed as an APA-style table in documents, like the other table functions, andapa_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, useapa_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, andtable_width) andoutputare deprecated. If any is given, a flextable is returned as before (or the table, foroutput = "tibble"), with a warning. Pass the table toapa_flextable(), which takes the same arguments, instead. -
column_formatsnow formats the summary columns. Before, it was ignored.
- With apaquarto, use
- 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. Useperformance_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 nowalpha, as inp2stars()andadd_star_column(). -
apa_p_star_note(x = )is nowalpha. -
add_break_columns(d = )is nowdata, 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::rlmmodels got anlmtable (with an ordinary-least-squares β and nothing saying the fit was robust),geepack::geeglmmodels got a GLM table (without a test statistic, and with likelihood ratio tests and AIC in lists), andmanova()models got anaovtable. 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()andapa_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.”), includinglm,glm, ordinal, and multinomial models, so notes that were empty now have a sentence, andapa_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 byapa_style().line_spacingnow 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 ofbyand 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). Newmissing = "row"shows the missing values of each variable in a “Missing” row instead of the note, andrange = TRUEadds 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), andlevel = "scales"gives one row per scale.flag = .30bolds item–total correlations below .30 and values of α if deleted above the scale’s α, asflagbolds large VIFs inapa_collinearity(). -
apa_descriptives()selectsvariables,by, andcategorical, andapa_reliability()selects the items inscalesandreverse, with unquoted or quoted names or tidyselect helpers (e.g.,variables = c(age, starts_with("item")), by = grouporscales = list(Anxiety = anx1:anx5), reverse = c(anx2, anx4)). - New
apa_means(),apa_contrasts(), andapa_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) frommodelbased::estimate_means(),estimate_contrasts(), andestimate_slopes(). They take a model (with the modelbased arguments, such asby,contrast,trend, andp_adjust) or the modelbased output. Other variables inbyget heading rows, probabilities from logistic models have no leading zero, andapa_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 inbywithout 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(inapa_contrasts()), andtrend(inapa_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 orNA, 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()andaov()): each difference divided by the model’s residual standard deviation, with an interval that accounts for the uncertainty in that standard deviation (as inemmeans::eff_size()). For mixed models, give the standard deviation withsd.effect_size = FALSEleaves d out, andapa_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 = FALSEleaves them out. - New
apa_n_factors()makes a factor retention table fromparameters::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. Withtable = "agreement", each suggested number of factors gets a row with the number of methods that suggest it and the cumulative variance explained. It can runparameters::n_factors()on a data frame or format its output, andapa_note()names the number of factors supported by the most methods. - New
apa_collinearity()makes tables of collinearity diagnostics fromperformance::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, andflag = 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 withPair()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 fromeffectsize::repeated_measures_d(). Newpair_labelsargument sets the headings above each pair’s descriptive statistics. -
apa_htest()accepts test results already computed: anhtestobject fromt.test(),wilcox.test(),cor.test(), orchisq.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), andapa_note()says how. - New
apa_subgroups()makes a table of a subgroup analysis of a meta-analysis fit withmetafor::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; withtau2 = "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 withmetafor::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 inapa_parameters(), andapa_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 fromlme4::lmer()orlmerTest::lmer(), and formats ANOVA tables from lmerTest’sanova(). Tests come from lmerTest, with Kenward-Roger (default, as inapa_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 frommanova(), fromlm()with several outcomes (lm(cbind(y1, y2) ~ x)), and fromcar::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, andtype = 2or3givescar::Anova()tests.univariate = TRUEshows the ANOVA of each outcome under its own heading instead.apa_note()names the statistic, the outcomes, N (when the model, rather than acar::Anova()table, is given), and the type of sums of squares. Before,manova()models were treated asaovmodels, and multivariatelm()models gave an error. -
apa_parameters()andapa_performance()support multinomial logistic regression models fit withnnet::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 (orcategory_headings = FALSEfor labels such as “Part time: Constant”). Exponentiated coefficients are odds ratios relative to the reference category, labeled OR, andapa_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()andapa_performance()support zero-inflated and hurdle count models fit withpscl::zeroinfl()andpscl::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” withcomponent_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()andapa_performance()support beta regression models fit withbetareg::betareg(), for outcomes between 0 and 1 such as proportions. The mean model and the precision model (φ) are under their own headings (or labeled withcomponent_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, andapa_performance_comparison()compares nested models with likelihood ratio tests. -
apa_parameters()andapa_performance()support quantile regression models fit withquantreg::rq(). Coefficients are tested with t tests, with standard errors chosen with the newseargument (Hendricks–Koenker sandwich estimates by default), andapa_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 withquantiles = "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()andapa_performance()support robust regression models fit withMASS::rlm()androbustbase::lmrob(). The table has the layout of a linear regression without standardized coefficients, andapa_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 oflmrobmodels and the robust scale ofrlmmodels.apa_performance_comparison()compares nestedlmrobmodels with robust Wald tests andrlmmodels without tests. Before,rlmmodels got an ordinary linear regression table, andlmrobmodels gave an error. -
apa_parameters()andapa_performance()support Cox proportional hazards models fit withsurvival::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, andapa_performance_comparison()compares nested models with likelihood ratio tests. -
apa_parameters()andapa_performance()support parametric survival models fit withsurvival::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, andapa_performance_comparison()compares nested models with likelihood ratio tests. -
apa_parameters()andapa_performance()support generalized additive models fit withmgcv::gam()andmgcv::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-byvariable, andapa_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()andapa_performance()support generalized estimating equations fit withgeepack::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,geeglmmodels 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()andapa_performance()support mixed models fit withglmmTMB::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 forlme4models. Zero-inflation and dispersion parts appear under their own headings (“Zero-inflation model”, “Dispersion model”), andapa_note()gives their scale. glmmTMB models also work in lists of models and inapa_performance_comparison(). -
apa_parameters()andapa_performance()support linear mixed models fit withnlme::lme(). Fixed effects are tested with t tests using nlme’s degrees of freedom, random effects are shown as forlme4models, 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.lmemodels also work in lists of models and inapa_performance_comparison(). -
apa_parameters()andapa_performance()support ordinal mixed models (cumulative link mixed models fit withordinal::clmm()). The predictors and thresholds are displayed as forordinal::clm()models (Wald z tests, cumulative odds ratios for logit links, and untested thresholds), and the random effects as forlme4models.apa_performance()shows the marginal and conditional R2 and AIC, andapa_performance_comparison()compares nested models with likelihood ratio tests. -
apa_performance()makes fit-index tables forlavaanmodels (e.g., fromlavaan::cfa()andlavaan::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 forlavaanmodels. Fully standardized estimates (β) with their standard errors and p-values are shown by default (standardize = FALSEfor 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, andapa_note()names them, along with the estimator, the standardization, and robust or bootstrap standard errors. -
apa_parameters()supports multiple-grouplavaanmodels. The groups are shown side by side under column spanners (or stacked under group headings withgroups = "rows"), andapa_note()gives each group’s size and names the parameters constrained to be equal across groups. -
apa_loadings()andapa_factor_cor()acceptlavaanmodels. 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 nestedlavaanmodels (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 fromlavaan::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 withcorrelation::correlation()(now imported) rather thanpsych::corTest(), so the table can show Spearman, Kendall, robust, partial, or multilevel correlations with the newmethod,p_adjust, andpartialarguments, and other arguments are passed tocorrelation::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, becauseapa_cor()uses internal names while computing them.apa_cor()also accepts the output ofcorrelation::correlation(). The note says what kind of correlations are shown and how the p-values were adjusted for multiple comparisons. -
apa_parameters()andapa_performance()support meta-analyses fit withmetafor::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 = FALSEkeeps 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 withmetafor::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 newcitationsargument ofapa_note()(oroptions(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’sbibliographyis enough. A bibliography set for a whole Quarto project or folder (in_quarto.ymlor_metadata.yml) is found, too. References cited in notes inside flextables (fromapa_flextable(note = TRUE),apa_cor(), andapa_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’snocitefield 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 oflavaan, 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: newprintandcitationsarguments set theapa7.printandapa7.citationsoptions. Its other simple settings (accuracy,font_family,intercept_text,width_aware_padding, andpage_width) are now R options, too (apa7.accuracy,apa7.font_family,apa7.intercept_text,apa7.width_aware_padding, andapa7.page_width), so they can be set withoptions(), including in an.Rprofilefile, before apa7 is loaded.apa7_defaults()checks its values before changing anything, and it returns the previous values of the settings it changed, whichdo.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_widthsetting inapa7_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’spagefunction (e.g.,"a4","a5","us-letter","us-legal").apa_flextable(),apa_cor(), andpretty_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, andtable_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 ininches,cm, ormm(e.g.,c(cm = 10)).- New
landscape_widthandcolumn_widthsettings inapa7_defaults()give these widths in inches. By default, they followpage_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_widthsetting inapa7_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-widthchunk option (apa7.widthin 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}). Atable_widthgiven to a function overrides it. A chunk with apaquarto’sapa-twocolumn: true, which spans a table across both columns of a two-column page, makes the table as wide as the page. - When
page_widthandtable_widthare not set withapa7_defaults(), the document being rendered supplies them: itspapersize(e.g.,papersize: a4) sets the paper, and apaquarto’sdocumentmodesets 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 withapa-twocolumn: truespans both columns. - The Getting Started article has a new section on table widths.
- New
- New
font_sizesetting inapa7_defaults()(theapa7.font_sizeoption) sets the font size of all tables and their notes (12 points by default).apa_flextable(),apa_style(),apa_cor(), andapa_chisq()use it unlessfont_sizeis given. - New
line_spacingsetting inapa7_defaults()(theapa7.line_spacingoption) 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(), andapa_chisq()use it unlessline_spacingis given. Notes stay single-spaced.
Other improvements and bug fixes
-
apa_parameters()andapa_performance()of multivariate linear models (lm(cbind(y1, y2) ~ x)) gave an internal error and a single residual SD for all outcomes. Nowapa_parameters()shows each outcome’s coefficients (B, SE, β, t, p) under a heading for each outcome, or side by side withoutcomes = "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 withmetrics = "all"). Lists of multivariate models give an error saying that they are not supported yet. - New
performance_layoutargument for lists of models inapa_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_scaleargument for mixed models inapa_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 bytable_widthwhenpretty_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
scalesandreverseofapa_reliability(), orvariablesofapa_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 asc(A1 = "Am indifferent to the feelings of others")could not be used. -
apa_performance(),apa_performance_comparison(), andapa_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 = FALSEorbold_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 thatapa_parameters()(forlme4andglmmTMBmodels) andapa_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, andCI_high, as in the output ofparameters::parameters()) ordf_errorbesidet. -
apa_format_columns()combines the confidence-interval columns of each column spanner (e.g.,Model 1_CI,Model 1_CI_low, andModel 1_CI_high) into one interval column with its own level (e.g., “Model 1_95% CI”). Before, it gave an error. ACIcolumn 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 thedf_errorcolumn. Before, the header was t, and the degrees of freedom were lost. -
apa_flextable(note = TRUE)adds the note of tables of several models fromapa_parameters(). Before, it gave an error, because the note’s information was lost along the way. -
apa_parameters(),apa_performance(), andapa_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 itsnames_prefix,names_sep, andnames_varyarguments, which it accepted but ignored. For example,names_prefix = "Model "turnsnames_fromvalues 1 and 2 into the spanners “Model 1” and “Model 2”. The defaults give the same names as before. -
header_align_verticalinapa_flextable()andapa_style()aligns the header cells of every table. Before, it applied only when the first column was namedVariableorPredictor, 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_zerosandadd_plussesinalign_chr(),inlineinapa_p(),bracketinmatrix_display(),typeinadd_list_column(), andright_tagintagger()), and units, accepted values, and defaults were added (e.g.,apa_flextable()andapa_style()sizes are in points).apa_note()lists every table function whose notes it writes, andapa_performance()lists its default metrics for each kind of model. - The documentation of
table_widthinapa_flextable(),apa_style(), andapa_chisq()now says that it is a proportion of the container’s width (from 0 to 1), not a width in pixels. Atable_widththat 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 foraovandlmmodels (Type 1 sums of squares, or Types 2 and 3 viacar::Anova()), repeated-measuresaovmodels withError()strata,afexmodels, and tables fromstats::anova()andcar::Anova(). Effect sizes (partial, non-partial, or generalized η2, ω2, or ε2) and their two-sided confidence intervals come fromeffectsize.New
apa_note()writes the text of a table note. Forapa_parameters()tables of regression models (including lists of models andlme4models), 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. Forapa_loadings()andapa_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. Forapa_anova()tables, it gives the type of sums of squares, which effects have sphericity-corrected degrees of freedom (afexmodels), 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 foraov, repeated-measuresaov, andafexmodels. Before,aovmodels were treated aslmmodels 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 supportspsych::principal()as well aspsych::fa(), and output fromparameters::factor_analysis()andparameters::principal_components()(including unrotated components fromstats::prcomp()). - New
bold_maxargument bolds the largest loading in each row. - New
factor_namesargument relabels the factors. - New
varianceargument 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, andformat_variable_namesarguments.apa_flextable()no longer reformats item text in theVariablecolumn. - Small loadings are now blank strings rather than
NA. - The unused
column_formatsargument has been removed.
- It now returns an
New
apa_factor_cor()makes a table of factor correlations from obliquely rotatedpsych::fa(),psych::principal(), andparameters::factor_analysis()solutions.column_format()gains anabbreviationslot 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 incolumn_formatsadds or changes a definition. The default column formats define common abbreviations (e.g., CI, AIC, BIC, RMSEA, effect sizes, and R2 variants), andcolumn_formats()gains aget_abbreviationsgetter. New column formatsh2,u2, andComplexityset the headers of thoseapa_loadings()columns.apa_flextable()gains anoteargument:TRUEadds the note fromapa_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, andEpsilon2_partial.make_apaquarto()andinstall_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). Newaskargument installs missing packages without asking whenFALSE. If installation is declined, the function stops and prints theinstall.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_apaquartoshiny app locally.