Hi,
I'm new to R and I'm trying to plot a grouped bar plot with se bars, but so far no success. I'd appreciate any words of wisdom. Thanks!
Dataset:
date year month site sample chla
2013-07-18 2013 July A1 1 0.001082
2013-08-14 2013 August A1 2 0.010676
2013-09-19 2013 September A1 3 0.00651
2013-07-18 2013 July A2 1 0.000772
2013-08-14 2013 August A2 2 0.002106
2013-09-18 2013 September A2 3 0.009325
2013-07-18 2013 July A3 1 0.000227
2013-08-13 2013 August A3 2 0.011545
2013-09-18 2013 September A3 3 0.015313
2013-07-19 2013 July A4 1 0.000297
2013-08-13 2013 August A4 2 0.014848
2013-09-18 2013 September A4 3 0.028509
Script:
#grouped bar plot with se bars (by site)
library(ggplot2)
ggplot(StandardMethodChla,aes(fill=month,y=chla,x=site))+
geom_bar(position="dodge",stat="identity")
se=sd(chla)/sqrt(length(chla))
ggplot(StandardMethodChla)+
geom_bar(aes(x=site,y=chla),stat="identity",fill=month,alpha=0.5)+
geom_errorbar(aes(x=site,ymin=mean-se,ymax=mean+se),width=0.4,
colour="orange",alpha=0.9,size=1.5)+
ggtitle("using standard error")