Formatting and presenting results

First, revisit the DAPR1 formatting resources.

LaTeX Symbols & Equations

By embedding LaTeX into RMarkdown, you can accurately and precisely format mathematical expressions, ensuring that they are not only technically correct but also visually appealing and easy to interpret.

For an overview of how to integrate LaTeX symbols and equations, review Lesson 9 of the RMD bootcamp.

APA Formatting

APA format is a writing/presentation style that is often used in psychology to ensure consistency in communication. APA formatting applies to all aspects of writing - from formatting of papers (including tables and figures), citation of sources, and reference lists. This means that it also applies to how you present results in your Psychology courses, including DAPR2.

All results should be presented following APA guidelines.

You also need to follow APA style rules for tables and figures.

Make sure to familiarise yourself with the above guides, and practice presenting your results following these rules.

Tables

We want to ensure that we are presenting results in a well formatted table. To do so, there are lots of different packages available (see Lesson 4 of the RMD bootcamp).

One of the most convenient ways to present results from regression models is to use the tab_model() function from sjPlot.

Within tab_model(), there are lots of different ways that you can customise your table. The most common arguments that you should use are dv.labels, pred.labels, and title.

You can rename your DV and IV labels by specifying dv.labels and pred.labels. To do so, specify your variable name on the left, and what you would like this to be named in the table on the right. For title, you can simply specify in ““’s what you want your title to be e.g., title = "This is my title".

Here’s an example if I had fitted a model with the following information:

  • Model name = mdl_test
  • Model DV = cognitive_score
  • Model IVs = SES and age
mdl_test <- lm(cognitive_score ~ SES + age, data = data_name)

I want to change the names of SES and age to be socio-economic status and age - in years respectively. What we need to pay attention to here is the ordering of the IVs - the ordering in our lm() must match that in tab_model(). I also want to name my table Regression Table for Cognitive Scores Model. Here is how we would do this in R:

library(sjPlot)
tab_model(mdl_test,
          pred.labels = c('Intercept', 'socio-economic status', 'age - in years'),
          title = "Regression Table for Cognitive Scores Model")

See here for another short example.

Cross Referencing

Cross-referencing is a very helpful way to direct your reader through your document, and the good news is that this can be done automatically in RMarkdown.

There are three key components to allow you to successfully cross-reference within your RMarkdown document:

  • A bookdown output format
  • A caption to your figure or table
  • A named/labeled code chunk

Once you have the above, you will be able to cross-reference using the syntax @ref(type:label), where label is the chunk name/label, and type is the environment being referenced (e.g. tab for table, fig for figure, etc.).

For an in-depth overview and example of how to cross-reference, see Lesson 7 of the RMD bootcamp.