I have a problem with turning my data into a nice figure. I already turned it into long form, now it looks like this:
Group ID variable value
1 AD TAS1R2 -0.000833344
1 FB TAS1R2 -0.073365073
1 KG TAS1R2 0.415858441
1 SK TAS1R2 2.528440629
1 TF TAS1R2 0.187186572
1 BO TAS1R2 0.078468279
1 NR TAS1R2 -0.177461374
1 RS TAS1R2 0.885323044
1 SL TAS1R2 -0.058843513
1 SiKo TAS1R2 0.165354200
2 AD TAS1R2 0.040824344
2 FB TAS1R2 0.159074753
2 KG TAS1R2 0.228949916
2 SK TAS1R2 0.261097901
2 TF TAS1R2 -0.173072190
2 BO TAS1R2 0.025892073
2 NR TAS1R2 -0.039772329
2 RS TAS1R2 1.213214193
2 SL TAS1R2 -0.037842870
2 SiKo TAS1R2 9.609456965
3 AD TAS1R2 0.006761916
3 FB TAS1R2 0.087384138
3 KG TAS1R2 2.018923012
3 SK TAS1R2 1.735388837
3 TF TAS1R2 0.754398704
Code:
cols <- colnames(df[3:9])
d <- melt(df, id.vars= c("Group", "ID"), measure.vars = cols)
When I try to plot it, I get a warning:
ggplot(d, aes(Group, value, col = variable)) +
stat_summary(fun.y = mean, geom ="point") +
stat_summary(fun.y = mean, geom = "line", aes(group = Group)) +
stat_summary(fun.data = mean_se, geom = "errorbar", width = 0.2)
geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?
I would like to connect the means of the variables across groups with lines. They are portrayed correctly with their dots and error bars, but it seems I either did something wrong when I made "d" or I am missing an argument that tells R how to connect the dots. Any ideas? Help would be greatly appreciated!