I am trying to create a table using apa_table(), Papaja, and RMarkdown in RStudio. Whenever I include longtable in the apa_table funct
You need the threeparttablex style for the ThreePartTable environment. In principle papaja tries to load this style, but there seems to be an incompatibility with recent rmarkdown. Since this seems to be a regression in rmarkdown, I have opened an issue for it. As a workaround you can downgrade to an older version of rmarkdown. Meanwhile, you can also install a fixed version from GitHub: remotes::install_github('rstudio/rmarkdown').