[R] error bars on barplot
Johannes Graumann
johannes_graumann at web.de
Fri Apr 9 14:46:48 CEST 2010
Jim Lemon wrote:
> 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
geom_errorbar (ggplot2)
Joh
More information about the R-help
mailing list