papaja is a R-package in the making including a RMarkdown template that can be used with RStudio (or without) to produce complete manscripts (PDF and Word documents), which conform to the American Psychological Association (APA) manuscript guidelines (6th Edition). To do so, papaja uses the LaTeX document class apa6 and a .docx-reference file. The supplied R-functions are ment to facilitate the reporting of statistics in accordance with APA guidelines.
Note, at this point papaja
is in active development and should be considered alpha. If you experience any problems, please open an issue.
If you are looking for other journal article templates, take a look at the list below. Finally, in case you prefer to work with Python, have a look at the Academic Markdown-module.
Take a look at the .rmd of the example manuscript in the folder example
and the resulting .pdf and .docx. More examples to come.
The example document also contains some basic instructions.
Before using papaja
to create an APA-manuscript, make sure the following software is installed on your computer:
- R (2.11.1 or later)
- RStudio (0.98.932 or later) is optional; if you don't use RStudio, you need to install pandoc using the instructions for your operating system
- A TeX distribution (2013 or later; e.g., MikTeX for Windows, MacTeX for Mac, obviously, or TeX Live for Linux)
- If you are running Windows, use MikTex if possible. Currently, pandoc and the Windows version of Tex Live don't seem to like each other. Make sure you install the complete---not the basic---version.
- If you are running Ubuntu 14.04 you need a couple of TeX packages in addition to the already installed ones for the document class
apa6
to work:
sudo apt-get install texlive texlive-latex-extra texlive-bibtex-extra texlive-publishers texlive-fonts-recommended texlive-fonts-extra texlive-humanities
Finally install papaja
from this GitHub repository:
devtools::install_github("crsh/papaja")
Once you have installed the papaja
package you can select the APA template when creating a new Markdown file through the menus in RStudio.
If you want to add citations specify your .bib-file in the document header and under the bibliography
parameter and you can start citing.
The supplied functions apa_stat()
and apa_table()
facilitate reporting of results.
In addition to the above, you need to do the following to use papaja
without RStudio:
- Install the
rmarkdown
package:
install.packages("rmarkdown")
- Use the
rmarkdown::draft
function to create articles:
rmarkdown::draft("mymanuscript.Rmd", template = "apa6_pdf", package = "papaja")
rmarkdown::draft("mymanuscript.Rmd", template = "apa6_word", package = "papaja")
- If building the example manuscript throws the error
! Incomplete \iffalse; all text was ignored after line 20.
, try updating your TeX-packages. - Citations may mess with RStudios syntax highlighting in the current line. Incorrect highlighting following a citation does not necessarily indicate incorrect syntax.
- When using the R-Package
xtable
to produce LaTeX-tables, the caption is set to the left page margin (s. the example manuscript). This is a more general issue of theapa6
document class. It can be resolved using\captionbox
instead of\caption
(see my SE question), which is AFAIK not possible withxtable()
. Tryapa_table()
. - Printing PDF from RStudio's PDF viewer can produce weird results. If you want to print your manuscript I suggest you use any other PDF viewer of your choice.
Obiously, not all journals require manuscripts and articles to be prepared according to APA guidelines. If you are looking for other journal article templates, the following list of other rmarkdown
/pandoc
packages and templates may be helpful:
- rticles: The rticles package includes a set of R Markdown templates that enable authoring of R related journal and conference submissions.
- Michael Sachs' pandoc journal templates: Pandoc templates for the major statistics and biostatistics journals
If you know of other packages and templates, drop us a note, so we can add them here.