Hi I was hoping someone might be able to help me I have this data: birdid timetaken numvisits ptachchoice time bold 1087 8 10 1 AM 0 1087 28 6 1 PM 0 1087 13 3 2 AM 0 1087 121 0 2 PM 0 1046 121 0 1 AM 1 1046 121 0 1 PM 1 i've plotted the means like this: by(numvisits,patchchoice,summary) numvisits.means<- by(numvisits,list(time=time,patchchoice=patchchoice),mean) numvisits.means barplot(numvisits.means,xlab="Patch Choice",ylab="Number of Visits",col=c("red","darkblue"),beside=T,ylim=c(0,4)) labs<-c("AM","PM") legend(1.09,3.98,labs,fill=cols) and need to add error bars, but i'm unsure as to how to do this. Thanks Sam [[alternative HTML version deleted]]
On 04/09/2010 08:55 PM, Samantha Reynolds wrote:> Hi > > I was hoping someone might be able to help me I have this data: > > birdid timetaken numvisits ptachchoice time bold > 1087 8 10 1 AM 0 > 1087 28 6 1 PM 0 > 1087 13 3 2 AM 0 > 1087 121 0 2 PM 0 > 1046 121 0 1 AM 1 > 1046 121 0 1 PM 1 > > i've plotted the means like this: > > by(numvisits,patchchoice,summary) > numvisits.means<- > by(numvisits,list(time=time,patchchoice=patchchoice),mean) > numvisits.means > barplot(numvisits.means,xlab="Patch Choice",ylab="Number of > Visits",col=c("red","darkblue"),beside=T,ylim=c(0,4)) > labs<-c("AM","PM") > legend(1.09,3.98,labs,fill=cols) > > and need to add error bars, but i'm unsure as to how to do this. >Hi Sam, Perhaps I should submit a FAQ on this one. Try: bar.err (agricolae) plotCI (gplots) xYplot (Hmisc) error.bars (psych) dispersion (plotrix) plotCI (plotrix) and there are probably others. Jim
> bar.err (agricolae) > plotCI (gplots) > xYplot (Hmisc) > error.bars (psych) > dispersion (plotrix) > plotCI (plotrix) >Not to mention: http://biostat.mc.vanderbilt.edu/wiki/Main/DynamitePlots Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/