9 Customizations
9.2 Adjusting line spacing
According to the APA guidelines, “Tables may be submitted either single- or double-spaced.” [p. 141; American Psychological Association (2010)].
Adjusting the line spacing of table contents is currently not supported in papaja
.
However, as usual it is possible to adjust the spacing in PDF documents by including additional \(\LaTeX\) code.
If you use apa_table()
, including the following in the YAML front matter will result in single-spaced tables with double-spaced caption and table note:
header-includes:
- \usepackage{setspace}
- \AtBeginEnvironment{tabular}{\singlespacing}
- \AtBeginEnvironment{lltable}{\singlespacing}
- \AtBeginEnvironment{tablenotes}{\doublespacing}
- \captionsetup[table]{font={stretch=1.5}}
- \captionsetup[figure]{font={stretch=1.5}}
Similarly, the line spacing of figure captions can be adjusted as follows:
header-includes:
- \usepackage{setspace}
- \AtBeginEnvironment{tabular}{\doublespacing}
- \AtBeginEnvironment{lltable}{\doublespacing}
- \AtBeginEnvironment{tablenotes}{\doublespacing}
- \captionsetup[table]{font={stretch=1.5}}
- \captionsetup[figure]{font={stretch=1}}
9.3 Writing dissertations
While papaja
is primarily intended for preparing journal articles and preprints, it is possible to create entire dissertations using it.
This is particularly useful for cumulative dissertation formats that include individual papers as separate chapters.
If the individual papers were written with papaja
, it is straight forward to include them in the dissertation document.
The first dissertation written using papaja
that I’m aware of is Contingency Awareness in Evaluative Conditioning: Investigations Using Subliminal Stimulus Presentations by Heycke (2018).
Tobias provides a brief tutorial on how he used papaja
.
9.4 Customizing apa_print()
apa_print()
is designed to format the results from various statistical methods in accordance with APA guidelines.
Of course, one size does not fit all and maybe you would like to report other or additional information.
This section will demonstrate how to use glue_apa_results()
to customize the output of apa_print()
.
library("afex")
## Loading required package: lme4
## Loading required package: Matrix
## ************
## Welcome to afex. For support visit: http://afex.singmann.science/
## - Functions for ANOVAs: aov_car(), aov_ez(), and aov_4()
## - Methods for calculating p-values with mixed(): 'KR', 'S', 'LRT', and 'PB'
## - 'afex_aov' and 'mixed' objects can be passed to emmeans() for follow-up tests
## - NEWS: library('emmeans') now needs to be called explicitly!
## - Get and set global package options with: afex_options()
## - Set orthogonal sum-to-zero contrasts globally: set_sum_contrasts()
## - For example analyses see: browseVignettes("afex")
## ************
##
## Attaching package: 'afex'
## The following object is masked from 'package:lme4':
##
## lmer
library("emmeans")
data(md_12.1)
<- aov_ez(
md_aov id = "id"
dv = "rt"
, data = md_12.1
, within = c("angle", "noise")
,
)
emmeans(md_aov, ~ angle * noise)
## angle noise emmean SE df lower.CL upper.CL
## X0 absent 462 29 19.8 402 522
## X4 absent 510 29 19.8 450 570
## X8 absent 528 29 19.8 468 588
## X0 present 492 29 19.8 432 552
## X4 present 660 29 19.8 600 720
## X8 present 762 29 19.8 702 822
##
## Warning: EMMs are biased unless design is perfectly balanced
## Confidence level used: 0.95
For the following example, we want to report pairwise comparisons between experimental conditions.
We use afex::aov_ez()
for the ANOVA and {emmeans} to preform the pairwise comparisons.
However, in addition to the frequentist NHST results, we also want to report Bayes factors for all comparisons.
Hence, we need to calculate the Bayes factors and add them to the $table
, $statistics
, and $full_result
elements of the list
returned by apa_print()
.