I have a dataframe similar to this one:
myTable <- "ID Data Group
1 -50 5.0
2 -44 5.0
3 -48 5.0
4 -50 4.9
5 -44 4.9
6 -48 4.9
7 -48 4.9
8 -44 4.8
9 -49 4.8
10 -48 4.8
11 -60 4.8
10 -50 4.8
11 -80 4.7"
Data <- read.table(text=myTable, header = TRUE)
The data is sorted by ID and Group. The groups do not all have the same size but have at least one member. The data is always negative. What I plan to do, is to make a line graph with the "Group" as x-axis and "Data" as y-axis and it should also show the standard deviation of each group.
I am a R beginner. So my knowledge is very limited, I only have a bit experience with the ggplot2 library. I tried to use the function geom_errorbar but without success. What I tried looked something like this:
require("ggplot2")
pplot <- ggplot(data=data, aes(x=group, y=data))
pplot + geom_errorbar(aes(ymax = <Max of each group>, ymin= <Min of each group> ), width= 0.1)
pplot + geom_line();