Code
library(tidyverse)
library(targets)
tar_source()
tar_load(c(exp1_data, exp2_data))
Aggregate data at the subject level
Plot data for each subject
---
title: "Subject-level data"
format: html
---
```{r}
#| label: init
#| message: false
library(tidyverse)
library(targets)
tar_source()
tar_load(c(exp1_data, exp2_data))
```
Aggregate data at the subject level
```{r}
#| label: aggregate_data
#| message: false
data_agg_subj <- bind_rows(
mutate(exp1_data, exp = "Exp 1"),
mutate(exp2_data, exp = "Exp 2")
) |>
group_by(id, exp) |>
nest() |>
mutate(data = map(data, aggregate_data)) |>
unnest(data)
```
Plot data for each subject
```{r}
#| label: joint_data
#| fig-width: 8.5
#| fig-height: 120
data_agg_subj |>
mutate(gap = as.factor(gap)) |>
ggplot(aes(gap, p_correct, color = chunk, group = interaction(chunk, id))) +
geom_point() +
geom_line() +
scale_color_discrete("1st chunk LTM?") +
facet_grid(id ~ itemtype) +
theme_pub()
```