Preliminaries

You can find the solutions for this exercise as well as the following ones in the exercises folder in the workshop material. You can also navigate the workshop material online (including exercises and solutions).

You can copy code from the exercise and solution files by clicking on the small blue clipboard icon in the upper right corner of the boxes showing the code.

Some of the exercise require you to add text and R code. Feel free to copy from the example paper in the folder exercises/example_manuscript. We do, however, encourage you to use material from a project of your own, if possible. It will be a lot more fun.

Exercises

In this exercise, you will create a first papaja document. The example data we use here is taken from the example manuscript provided with the workshop material. However, we encourage you to use your own data for this and the following exercises.

Document template

Exercise 1

Create a new papaja document and populate the YAML front matter of with the manuscript metadata.

File > New File > R Markdown… > From Template

In the YAML front matter, the note field and each author’s role field can simply be omitted.



Exercise 2

Make your manuscript “preprint-ready”:

  1. Hide line numbers,
  2. use the single-column single-spaced document style (i.e. use the "doc" class option), and
  3. add a “DRAFT” watermark on every page.
Use the draft and linenumbers options in the YAML front matter.



Report statistics

Exercise 3

Now let’s report some results.

  1. Copy the contents of your R Markdown document to your papaja document.
  2. Report the nummerical results of one or more analysis using in-line code chunks. If possible, use apa_print().

If you are working with the example manuscript, locate and open the R-script analyses.R and data folder data accompanying the example manuscript in the folder exercises/3_papaja_example_manuscript.

If you are unsure, whether your analysis is supported, methods(apa_print) provides a list of supported classes.

If you cannot use apa_print() you will need to manually pick numerical results from your results object. str() may help to find the numbers you are looking for and apa_num(), apa_p(), apa_df(), and apa_confint() will facilitate formatting.



Figures and tables

Exercise 4

Add a figure and/or table to your results section and cross-reference it in the text. Use text-references to add a caption.

You can use apa_factorial_plot() (or one of the short-hands apa_barplot(), apa_beeplot(), and apa_lineplot()) or try our ggplot2-theme theme_apa(), if applicable.

Handles used to cross-reference figures and tables are generated automatically from the chunk label:

  • fig:chunk-label or
  • tab:chunk-label.
Text reference definitions must be on their own line, surrounded by empty lines, and start with (ref:reference-name).



Bonus

Bonus 1

Try out the DOCX output format.
The DOCX format is provided by apa6_docx().



Bonus 2

Add an appendix to your manuscript.

To start an appendix, use the following special heading:

# (APPENDIX) Appendix {-}



Bonus 3

Manually (i.e. without using apa_print()) report the results for the following one-sided t-test according to the APA guidelines.

t.test(extra ~ 1, data = sleep, alternative = "greater")

Report

  • mean difference,
  • confidence interval,
  • degrees of freedom,
  • \(t\) value, and
  • \(p\) value.
str() may help to find the numbers you are looking for and apa_num(), apa_p(), apa_df(), and apa_confint() will facilitate formatting.

Solutions

After you have tried yourself, feel free to have a look at our solutions.