Format Outputs of Statistical Tests According to APA Guidelines

Formatter functions in the 'apa' package take the return value of a statistical test function, e.g. a call to chisq.test() and return a string formatted according to the guidelines of the APA (American Psychological Association).

apa's functions format output of statistical tests according to guidelines of the APA (American Psychological Association), ready to copy-and-paste into manuscripts.

The idea of such formatters was introduced in the schoRsch package. apa generalizes this idea by providing formatters for different output formats (text, Markdown, RMarkdown, HTML, LaTeX, docx and R's plotmath syntax).

Currently available formatters are:

  • anova_apa()2
  • chisq_apa()
  • cor_apa()
  • t_apa()

Further miscellaneous functions:

  • apa(): A wrapper around the *_apa()-functions for use in inline code in RMarkdown documents.
  • cohens_d() / cohens_d_(): Calculate Cohen's d effect size (from raw data, t-test or statistical parameters). Also supports Hedge's g* and Glass's Δ.
  • t_test: A wrapper around t.test() that includes the original data in its return list (in order to calculate the effect size in cohens_d() and t_apa() directly from the data).

1 pandoc is required for docx output and needs to be installed manually when not using RStudio (which ships pandoc).

2 Supports input from aov(), ezANOVA() from the ez package and aov_ez() / aov_car() / aov_4() from the afex package.


The development version can be installed using:

# install.packages("devtools")

Related approaches


apa 0.3.2

Bug fixes

  • Fix a test that returned a wrong result in r-devel (t-test now returns a list with more elements).

apa 0.3.1

Bug fixes

  • Fix a bug in t_test when the independent variable has unused factor levels.
  • Fix a test that assumed no empty groups present (needed for dplyr 0.8

apa 0.3.0

New features

  • Add LaTeX math output format (#3)

Bug fixes and minor improvements

  • Fix error in anova_apa when specifying the effect argument
  • Fix printing of p-values if p = 1.
  • Add missing else in anova_apa. (@stegmannks, #6)
  • Fix error in calculation of sample size from degrees of freedom in Cohen's d for dependent samples (@lcreteig, #7)

apa 0.2.0

New features

  • Add support for aov in anova_apa.

Bug fixes and minor improvements

  • Fix bug when using abbreviations "pes" or "ges" in anova_apa.
  • Provide same order of effects in anova_apa independent of input object
  • In anova_apa significance asterisks might have been incorrect when p-values were corrected for violation of sphericity.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.3.3 by Daniel Gromer, 2 years ago

Report a bug at

Browse source code at

Authors: Daniel Gromer [aut, cre]

Documentation:   PDF Manual  

GPL (>= 3) license

Imports dplyr, magrittr, MBESS, purrr, rmarkdown, stringr, tibble

Suggests afex, ez, testthat, knitr

See at CRAN