# Now get the average difference between these interactions
data %>%
reframe(
# Get the TC interaction when K is A
d1a = y[t==180&k=="A"&c==40] - y[t==160&k=="A"&c==40],
d0a = y[t==180&k=="A"&c==20] - y[t==160&k=="A"&c==20],
dbar_a = (d1a - d0a)/2,
# Get the TC interaction when K is B
d1b = y[t==180&k=="B"&c==40] - y[t==160&k=="B"&c==40],
d0b = y[t==180&k=="B"&c==20] - y[t==160&k=="B"&c==20],
dbar_b = (d1b - d0b)/2,
# Get three way interaction effect
dbar = (dbar_b - dbar_a) / 2
)
d1a d0a dbar_a d1b d0b dbar_b dbar
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
14 12 1 35 31 2 0.5