[1] 4
Code Chunks, Loading Data, and Inline Reporting
April 29, 2026
We will use eye-tracking reading data from Palleschi et al. (2025), adapted for this workshop.
verb of interest for todaygaze (first-pass reading time) for todayrating (1–7 plausibility), rt_ms (reaction time to rating)px_code) are randomly generated; we will anonymise these laterTip
The verb region is the most theoretically relevant. We will focus on gaze in most exercises.
```{r} and ``````{r}, and#| + an empty space, and| Option | Effect |
|---|---|
echo |
show or hide code |
output |
show or hide output |
eval |
run or skip chunk |
include |
include chunk and output |
warning |
show or hide warnings |
message |
show or hide messages |
error |
halt on error (false) or continue and display error (true) |
Set globally in YAML:
Always load pacakges at the top of your script!
I like the pacman::p_load() function for loading packages instead.
Always use here::here() for project-relative paths:
Save processed objects so the manuscript never re-runs the analysis:
Note
The analysis script processes/analyses data and saves it under a new filename.
The manuscript script loads in the processed/analysed data and models and reports them.
eval: true or false?In an analysis script, which code chunks should be evaluated when rendering?
.rds fileseval: false because we don’t want it to be saved with each renderprocessed dataInstead of typing numbers manually:
“The sample comprised 48 participants.”
Re-render when data changes – numbers update automatically.
The sample comprised 24 participants. Mean total reading time was 350 ms (SD = 56).
here::here() makes paths portable — the manuscript only loads, never re-runsAnalyses and manuscripts in Quarto
R for Publication - Day 2: Data and Code in Quarto