I am trying to create nested facets. In the example below, there are 4 experiments. Each experiment has 2 subjects with 2 test scores. I would still like each subj_num
on a separate plot, but for each subj_num
in a given exp_num
to be linked, with a facet that extends across both plots. Is this possible?
library(tidyverse)
dat <- data.frame(exp_num = rep(1:4, each=4),
subj_num = rep(1:8, each=2),
test_num = rep(1:2, 2),
score = sample(16)
)
ggplot(dat, aes(test_num, score)) +
geom_line() +
facet_grid(exp_num+subj_num~.)