Writing APA papers in R Markdown with papaja

A brief tutorial

Matthew Crump

10/31/2019

What is papaja

papaja is an R package written by Frederick Aust & Marius Barth.

papaja provides an R Markdown template for writing APA papers that can be compiled to .pdf or word document formats

papaja documentation

The documentation for using papaja is here

Installing papaja

  1. Make sure you have devtools installed. papaja is not on CRAN, and we use devtools to install the package from Github.
install.packages("devtools")
  1. Install Latex (for rendering to pdf). Note, rather than installing a full distribution, we can use the tinytex package which will install the components we need as we need them.
install.packages("tinytex")
tinytex::install_tinytex()
  1. Install papaja
devtools::install_github("crsh/papaja")

Writing an APA paper with papaja

papaja process diagram

A Walkthrough

  1. Let’s go through the papaja documentation
  2. And, look at the example manuscript.Rmd file in the manuscript/ folder.

Additional considerations/tips

  1. set classoption to “man” for double-spaced draft style, or to “jou” for two-column apa-journal style.
  1. We recommend placing raw data in the data-raw folder, and including a pre-processing script showing how the data is loaded into R. In this example, I also added the resulting dataframe to the R package for this tutorial, and then loaded the package in the manuscript to load the pre-processed data.
  1. There other many strategies for creating a reproducible analysis. A large paper may have many code chunks and become unwieldly. It is possible to run the analysis scripts outside of the main document. For example, an analysis script might save R variables in an .RData or .Rda file, which can then be loaded in the main manuscript for reporting.

Zotero

Consider using Zotero as a free and very useful citation manager https://www.zotero.org

Multi column