Have nothing to do with Caipirinhas or Margaritas
mean.values = c(3, 4, 2, 3, 4, 1.5, 3.5, 4, 4.2, 4.1, 3.5, 2.9, 1.8) # mean values
barplot(mean.values, col = "red")
It is also possible to add simple error bars
std.dev = c(0.1, 0.1, 0.15, 0.15, 0.2, 0.1, 0.1, 0.15, 0.15, 0.2, 0.3, 0.05, 0.35) # standard deviation
length(mean.values) == length(std.dev)
## [1] TRUE
# need space for the upper error bar of the biggest bar:
ylim = c(0, max(mean.values) + 1.2 * max(std.dev))
midpoints <- barplot(mean.values , names.arg = LETTERS[1:length(mean.values)], ylim = ylim)
segments(midpoints, mean.values - 2*std.dev , midpoints, mean.values + 2*std.dev, col = "black", lwd = 3)
arrows(midpoints, mean.values - 2*std.dev, midpoints, mean.values + 2*std.dev,
lwd = 1.5, angle = 90, code = 3, length = 0.05)
Much nicer plots can be created using the ggplot2 library!