• Visualize an interaction with ggplot

    I've had to do this enough times (and have to look it up each time) that I decided to memorialize it here. The issue: I have a two-way repeated measures design and I want to visualize all four cells. I'd like one plot to contain the individuals responses as well as the cell means. But I also want to link individuals together. The solution: Plot the individual differences within each level of one of the factors using separate lines for each subject, plus an additional line for the cell means. Here's a simple demo (with a bonus example of how to simulate such a dataset).