Note that there are some explanatory texts on larger screens.

plurals
  1. POggplot not drawing connection lines between group means any more?
    primarykey
    data
    text
    <p>I seem to have missed a change within how ggplot2 works. I have an example from a statistics textbook (A. Field (2012), Discovering statistics using R, p. 593) which I'm sure worked but now does not produce connection lines between means of grouped data any more.</p> <p>Here's the sample data:</p> <pre><code>participant&lt;-gl(20, 9, labels = c("P01", "P02", "P03", "P04", "P05", "P06", "P07", "P08", "P09", "P10", "P11", "P12", "P13", "P14", "P15", "P16", "P17", "P18", "P19", "P20" )) drink&lt;-gl(3, 3, 180, labels = c("Beer", "Wine", "Water")) imagery&lt;-gl(3, 1, 180, labels = c("Positive", "Negative", "Neutral")) groups&lt;-gl(9, 1, 180, labels = c("beerpos", "beerneg", "beerneut", "winepos", "wineneg", "wineneut", "waterpos", "waterneg", "waterneut")) attitude&lt;-c(1, 6, 5, 38, -5, 4, 10, -14, -2, 26, 27, 27, 23, -15, 14, 21, -6, 0, 1, -19, -10, 28, -13, 13, 33, -2, 9, 7, -18, 6, 26, -16, 19, 23, -17, 5, 22, -8, 4, 34, -23, 14, 21, -19, 0, 30, -6, 3, 32, -22, 21, 17, -11, 4, 40, -6, 0, 24, -9, 19, 15, -10, 2, 15, -9, 4, 29, -18, 7, 13, -17, 8, 20, -17, 9, 30, -17, 12, 16, -4, 10, 9, -12, -5, 24, -15, 18, 17, -4, 8, 14, -11, 7, 34, -14, 20, 19, -1, 12, 43, 30, 8, 20, -12, 4, 9, -10, -13, 15, -6, 13, 23, -15, 15, 29, -1, 10, 15, 15, 12, 20, -15, 6, 6, -16, 1, 40, 30, 19, 28, -4, 0, 20, -10, 2, 8, 12, 8, 11, -2, 6, 27, 5, -5, 17, 17, 15, 17, -6, 6, 9, -6, -13, 30, 21, 21, 15, -2, 16, 19, -20, 3, 34, 23, 28, 27, -7, 7, 12, -12, 2, 34, 20, 26, 24, -10, 12, 12, -9, 4) longAttitude&lt;-data.frame(participant, drink, imagery, groups, attitude) </code></pre> <p>And here's the plot code:</p> <pre><code>library(ggplot2) attitudeInt &lt;- ggplot(longAttitude, aes(drink, attitude, colour = imagery)) attitudeInt + stat_summary(fun.y = mean, geom = "point") + stat_summary(fun.y = mean, geom = "line", aes(group = imagery)) + stat_summary(fun.data = mean_cl_boot, geom = "errorbar", width = 0.2) + labs(x = "Type of Drink", y = "Mean Attitude", colour = "Type of Imagery") </code></pre> <p>Isn't it the case that the part <code>stat_summary(fun.y = mean, geom="line", aes(group = imagery))</code> should draw exactly these connection lines?</p> <p>Thanks for your help.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload