Recreating APA Manual Table 7.5 in R with apa7

Demonstration of the apa7 package, a flextable extension package
R
APA Style
Author
Affiliation
Published

September 15, 2025

Making tables in APA style (Part 5 of 24)

In this 24-part series, each of the tables in Chapter 7 of the Publication Manual of the American Psychological Association (7th Edition) is recreated with apa7, flextable, easystats, and tidyverse functions.

NoteHighlights
  • Using width to make column widths consistent.
library(apa7)
library(flextable)
library(ftExtra)
library(tidyverse)
set_flextable_defaults(theme_fun = theme_apa, 
                       font.family = "Times New Roman")

Figure 1

Screenshot of the APA Manual’s Table 7.5

Reproducing APA Manual Table 7.5 shown in Figure 1 is mostly straightforward. The default column widths (provided by flextable’s dim_pretty) look good, but providing custom widths can give the table a sharper, more consistent appearance.

```{r}
#| label: tbl-75
#| tbl-cap: Summary of Designs of Experiments 1–4
#| apa-note: "A, X, Y, and B = tone, clicker, 
#|           steady light, and flashing light, respectively 
#|           (counterbalanced), with the constraint that 
#|           A and B are drawn from one modality and X and 
#|           Y from another (counterbalanced); plus
#|           sign (+) = shock to floor of rat
#|           chamber; minus sign (–) = absence
#|           of shock."
# Make data
d <- tibble(
     Experiment = paste("Experiment", rep(1:4, c(2,3,2,3))),
          Group = c("Compound","Compound novel",
                    "Compound A","Compound X","Compound novel",
                    "Compound","Element",
                    "Control","Element A","Element Y"),
     `Preexposure 1` = c(rep("A−X−Y−", 7), 
                         NA, 
                         rep("A−X−Y−", 2)), 
     `Preexposure 2` = c(rep("AX−BY−", 5), 
                         rep("AX−Y−", 2), 
                         NA, 
                         rep("A−X−Y−", 2)), 
   Conditioning = c("X+","Y+",
                    "A+","X+","Y+",
                    "X+","Y+",
                    "A+/Y+","A+","Y+"),
           Test = c("X−","Y−",
                    "A−","X−","Y−",
                    "X−","Y−",
                    "A−Y−","A−","Y−")
) 

# Make table
d |> 
  apa_flextable(row_title_column = Experiment, 
                line_spacing = 1.5) |> 
  align(j = 1, align = "left") |> 
  width(width = c(1.7, rep(1.2, 4)))
```

Table 1

Summary of Designs of Experiments 1–4

Group

Preexposure 1

Preexposure 2

Conditioning

Test

Experiment 1

Compound

A−X−Y−

AX−BY−

X+

X−

Compound novel

A−X−Y−

AX−BY−

Y+

Y−

Experiment 2

Compound A

A−X−Y−

AX−BY−

A+

A−

Compound X

A−X−Y−

AX−BY−

X+

X−

Compound novel

A−X−Y−

AX−BY−

Y+

Y−

Experiment 3

Compound

A−X−Y−

AX−Y−

X+

X−

Element

A−X−Y−

AX−Y−

Y+

Y−

Experiment 4

Control

A+/Y+

A−Y−

Element A

A−X−Y−

A−X−Y−

A+

A−

Element Y

A−X−Y−

A−X−Y−

Y+

Y−

Note. A, X, Y, and B = tone, clicker, steady light, and flashing light, respectively (counterbalanced), with the constraint that A and B are drawn from one modality and X and Y from another (counterbalanced); plus sign (+) = shock to floor of rat chamber; minus sign (–) = absence of shock.

Citation

BibTeX citation:
@misc{schneider2025,
  author = {Schneider, W. Joel},
  title = {Recreating {APA} {Manual} {Table} 7.5 in {R} with Apa7},
  date = {2025-09-15},
  url = {https://wjschne.github.io/posts/apatables/apa705.html},
  langid = {en}
}
For attribution, please cite this work as:
Schneider, W. J. (2025, September 15). Recreating APA Manual Table 7.5 in R with apa7. Schneirographs. https://wjschne.github.io/posts/apatables/apa705.html