Hello, I am very new to R and wanted to demonstrate a possible interaction between two variables in a line graph. However, the graph that I get does include all the individual reaction times values rather than the means. I guess my data might be in the wrong format? Currently, my position and tense conditions are specified in a different column each and the reaction time as outcome variable in yet another column.
The code that I used was:
line <- ggplot(data_tense_final, aes(f2.f.position, RT3, colour = f2.f.tense))
line +
stat_summary(fun.y = mean, geom = "point") +
stat_summary(fun.y = mean, geom = "line", aes(group = f2.f.tense)) +
stat_summary(fun.data = mean_cl_boot, geom = "errorbar", width = 0.2) +
labs(x = "Position", y = "Mean RT", colour = "f2.f.tense")
The dataframe looks more or less like this:
f2.f.participant f2.f.condition f2.f.tense f2.f.position RT3
1 1 1 past back 445.944444444444
2 1 2 future front 448.882352941176
3 1 3 past front 454.222222222222
4 1 4 future back 526.4375
5 2 1 past back 338.631578947368
6 2 2 future front 342.058823529412
7 2 3 past front 350.222222222222
8 2 4 future back 341.266666666667
9 3 1 past back 331
10 3 2 future front 325.647058823529
The output from deput(x) is:
structure(list(f2.f.position = c("back", "front", "front", "back",
"back", "front", "front", "back", "back", "front", "front", "back",
"back", "front", "front", "back", "back", "front", "front", "back"
), RT3 = c("445.944444444444", "448.882352941176", "454.222222222222",
"526.4375", "338.631578947368", "342.058823529412", "350.222222222222",
"341.266666666667", "331", "325.647058823529", "303.9375", "361.111111111111",
"304.722222222222", "288.647058823529", "281.823529411765", "309.944444444444",
"304.722222222222", "288.647058823529", "281.823529411765", "309.944444444444"
), f2.f.tense = c("past", "future", "past", "future", "past",
"future", "past", "future", "past", "future", "past", "future",
"past", "future", "past", "future", "past", "future", "past",
"future")), row.names = c(1L, 20L, 39L, 58L, 77L, 96L, 115L,
134L, 153L, 172L, 191L, 210L, 229L, 248L, 267L, 286L, 305L, 324L,
343L, 362L), class = "data.frame")
I've probably made a very obvious mistake, apologies in advance! Many thanks!