knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

apatfa

R-CMD-check

The apatfa package generates a Word (docx) file containing APA Tables, Figures, and Appendix sections.

Installation

You can install the development version of apatfa from GitHub with:

devtools::install_github("toddagood/apatfa")

Example

Please see paper.R and paper.docx in apatfa/inst/iris/.

Details

The apatfa (a-pat-fa) package automates the creation of "Tables", "Figures", and "Appendix" sections for scholarly papers written in MS Word using the APA style guide. The name apatfa is an abbreviation for American Psychological Association Tables, Figures, and Appendices. According to APA style, tables and figures can either be placed within the body of the paper or they can be grouped into end sections. The apatfa package takes the approach of always putting tables and figures in end sections (along with the appendices) in order to keep a clear separation between input and output documents in the document workflow. Your manually entered body content is kept in an input docx file and the content generated by R is kept in a separate output docx file. The output docx file is then included (by reference, with auto-refresh) back into the input docx file by using the IncludeText feature of Word.

The main function apa_docx() generates an output docx file containing bookmarked content (tables, figures, and appendices) numbered and organized in APA style sections. Within each output section, the content is ordered by the first bookmark reference to the content from within the input docx file. After the output file is included into the end of the input file using a Word IncludeText field, the bookmarked content in the output docx file will be available for reference from within the input docx file in the usual way (by using the Word > Insert > Cross Reference > Bookmark menu).

This package primarily uses the officer and flextable packages, but the difference here is the obsession with conforming to the APA style guide. For example, in APA style, numeric table columns should be center-aligned and at the same time should be decimal-aligned, which flextables do not support, while apatfa supports that and does it by default.

The apatfa package uses the officer package to read and write docx files, uses the flextable package to style tables, and uses the ggplot2 package to style figures. I really appreciate the work of David Gohel and the other contributors to the officer and flextable packages.

Here are the basic steps for using apatfa to create a paper:

install.packages("devtools")
install_github("toddagood/apatfa")
library(apatfa)
extrafont::fonts()

The documentation for the functions can be opened with the command help(package = "apatfa").

To learn more about apatfa, start with the vignettes (coming soon): browseVignettes(package = "apatfa").



toddagood/apatfa documentation built on Jan. 30, 2023, 11:51 p.m.