R for Publication
  • D. Palleschi
  • PDF
  1. Exercises
  2. Set-up
  • Preface
  • Session 1: Quarto foundations
    • 1  (R)Project Hygiene
    • 2  Writing in Quarto
    • 3  Output Formats
  • Session 2: Data and results
    • 4  Open and Reproducible Research
    • 5  Data and code
    • 6  Fitting and reporting models
  • Exercises
    • Set-up
    • Session 1 Exercises
    • Session 2 Exercises
  • References

Table of contents

  • Before you begin
    • Option A: Use the workshop repository (recommended)
      • With Git
      • Without Git
      • After cloning or downloading
    • Option B: Set up your own RProject
ZAS Leibniz
  1. Exercises
  2. Set-up

Set-up

Before you begin

These exercises require you to be working in Quarto within an RProject, ideally the same RProject designed for this workshop (https://github.com/daniela-palleschi/publishr-workshop). Choose one of the two setup options below depending on your situation.

Option A: Use the workshop repository (recommended)

With Git

This requires Git to be installed. Check by running git --version in the terminal — if it is not installed, download it from git-scm.com.

Before cloning, decide whether to use HTTPS or SSH. If you are unsure, use HTTPS. SSH requires keys to be configured with GitHub but avoids needing to enter credentials each time.

  • HTTPS URL: https://github.com/daniela-palleschi/publishr-workshop.git
  • SSH URL: git@github.com:daniela-palleschi/publishr-workshop.git

Via the terminal:

git clone https://github.com/daniela-palleschi/publishr-workshop.git

Via RStudio: File → New Project → Version Control → Git, then paste the URL into the dialog box.

Via Positron: File → New Folder from Git Repository, then paste the URL.

Without Git

  1. Go to github.com/daniela-palleschi/publishr-workshop
  2. Click the green Code button and select Download ZIP
  3. Unzip the folder somewhere sensible on your machine

After cloning or downloading

  1. Open publishr-workshop.Rproj in RStudio or Positron
  2. Copy your data file to data/raw/ (or use the sample dataset; see below)
  3. Open exercises/day1.qmd and work through the exercises

Option B: Set up your own RProject

If you would prefer to use your own project:

  1. Create a new RProject: File → New Project → New Directory → New Project
  2. Create the following folder structure in the terminal:
mkdir -p data/raw data/processed exercises output/figures output/tables output/models
  1. Download the sample dataset (a subset from Palleschi et al. (2025); https://osf.io/6sra7) and save it to data/raw/:
👉 Download example dataset
  1. Create a new Quarto document: File → New File → Quarto Document, and save it as exercises/day1.qmd
  2. Install the required packages:
install.packages("pacman")
pacman::p_load(here, tidyverse, gt, kableExtra, broom, modelsummary)
NoteSample dataset

The sample dataset used in these exercises is a subset of a reading time study with the following structure: one row per word region per trial per participant, with columns including px (participant ID), item (item ID), region (sentence region), tense, lifetime, gaze (first-pass reading time), tt (total reading time), rpd (regression path duration), first_fix (first fixation duration), and rating (plausibility rating, 1–7).

Tip

If you are using Option B and your data has different column names, adapt the code in the exercises accordingly. The key variables used are region, gaze, tt, and rating.

Palleschi, D., Ronderos, C. R., & Knoeferle, P. (2025). Living in the present – how referent lifetime influences processing of past, present (perfect), and future tenses. Glossa Psycholinguistics, 4(1), 1–48. https://doi.org/https://doi.org/10.5070/G601119481
6  Fitting and reporting models
Session 1 Exercises
Source Code
---
editor: source
---

# Set-up {.unnumbered}

## Before you begin

These exercises require you to be working in Quarto within an RProject, ideally the same RProject designed for this workshop ([https://github.com/daniela-palleschi/publishr-workshop](https://github.com/daniela-palleschi/publishr-workshop)). Choose one of the two setup options below depending on your situation.

### Option A: Use the workshop repository (recommended)

#### With Git

This requires Git to be installed. Check by running `git --version` in the terminal — if it is not installed, download it from [git-scm.com](https://git-scm.com/downloads).

Before cloning, decide whether to use HTTPS or SSH. If you are unsure, use HTTPS. SSH requires keys to be configured with GitHub but avoids needing to enter credentials each time.

- **HTTPS URL:** `https://github.com/daniela-palleschi/publishr-workshop.git`
- **SSH URL:** `git@github.com:daniela-palleschi/publishr-workshop.git`

**Via the terminal:**
```bash
git clone https://github.com/daniela-palleschi/publishr-workshop.git
```

**Via RStudio:** *File → New Project → Version Control → Git*, then paste the URL into the dialog box.

**Via Positron:** *File → New Folder from Git Repository*, then paste the URL.

#### Without Git

1. Go to [github.com/daniela-palleschi/publishr-workshop](https://github.com/daniela-palleschi/publishr-workshop)
2. Click the green **Code** button and select **Download ZIP**
3. Unzip the folder somewhere sensible on your machine

#### After cloning or downloading

1. Open `publishr-workshop.Rproj` in RStudio or Positron
2. Copy your data file to `data/raw/` (or use the sample dataset; see below)
3. Open `exercises/day1.qmd` and work through the exercises

### Option B: Set up your own RProject

If you would prefer to use your own project:

1. Create a new RProject: *File → New Project → New Directory → New Project*
2. Create the following folder structure in the terminal:
```bash
mkdir -p data/raw data/processed exercises output/figures output/tables output/models
```

3. Download the sample dataset (a subset from @palleschi_living_2025; [https://osf.io/6sra7](https://osf.io/6sra7)) and save it to `data/raw/`:

```{=html}
👉 <a href="https://raw.githubusercontent.com/daniela-palleschi/publishr-workshop/main/data/raw/data_example.csv">Download example dataset</a>
```
```{=latex}
Download the example dataset at: \url{https://raw.githubusercontent.com/daniela-palleschi/publishr-workshop/main/data/raw/data_example.csv}
```

4. Create a new Quarto document: *File → New File → Quarto Document*, and save it as `exercises/day1.qmd`
5. Install the required packages:
```r
install.packages("pacman")
pacman::p_load(here, tidyverse, gt, kableExtra, broom, modelsummary)
```

::: callout-note
## Sample dataset
The sample dataset used in these exercises is a subset of a reading time study with the following structure: one row per word region per trial per participant, with columns including `px` (participant ID), `item` (item ID), `region` (sentence region), `tense`, `lifetime`, `gaze` (first-pass reading time), `tt` (total reading time), `rpd` (regression path duration), `first_fix` (first fixation duration), and `rating` (plausibility rating, 1--7).
:::

::: callout-tip
If you are using Option B and your data has different column names, adapt the code in the exercises accordingly. The key variables used are `region`, `gaze`, `tt`, and `rating`.
:::

```{r}
#| label: setup
#| include: false
pacman::p_load(here, tidyverse)
```