I have used errbar
to produce a figure in R showing mean and standard deviation.
Here is my code
errbar(data$Type, data$Mean,data$Mean+data$Std,data$Mean-data$Std,
xlab="Type",ylab="Score", ylim=c(0,10))
which produces a plot of mean and std (horizontally):
I would like to produce a figure where for each "type" (category) there is more than one mean/std shown on the plot. So the plot I want would look something like this (or with multiple data points for each category):
Can I use the errbar
function to do this? If not, how would you suggest doing this in R?
Here is the output from dput(data):
structure(list(Type = structure(c(8L, 5L, 7L, 2L, 1L, 6L, 3L, 4L),
.Label = c("A", "B", "C", "D", "E", "G", "H", "R"),
class = "factor"), Mean = c(5.26785714285714, 5.41071428571429, 5.92857142857143,
6.23333333333333, 6.3, 7.78571428571429, 8.38333333333333, 8.75),
Std = c(2.3441094046778, 1.80971508291186, 1.50457178749844, 1.86716617466403, 1.93233759251032,
1.3931740974961, 1.06848802832164, 1.00445436503037)),
.Names = c("Type", "Mean", "Std"),
row.names = c(8L, 5L, 7L, 2L, 1L, 6L, 3L, 4L), class = "data.frame")