The inevitable:
y
, but three measured before some treatment and three measured after.y
-values for pre
and for post
.pivot_wider
.pre
values and three post
. Why did this happen?pivot_wider
needs to know which row to put each observation in.pivot_wider
, here obs
(only).obs
values, so 6 different rows.obs
2 and pre
, so that cell missing (NA
).obs
needs to say which subject provided which 2 observations.subject
shows which subject provided each pre
and post
.pivot_wider
, now only 3 rows, one per subject.subject
, and now a pre
and post
for each subject
.pivot_wider
: nothing!unnest
: