[R] Bar plot with error bars

John Kane jrkrideau at yahoo.ca
Tue Oct 23 15:58:17 CEST 2007


library(gplots)
?barplot2

should give you what you want.


--- Katherine Jones <kajones at connect.carleton.ca>
wrote:

> Apologies if this has been asked before. I am having
> trouble  
> understanding the R mailing list never mind R!
> 
> I am relatively new to R having migrated from
> Minitab and SPSS. I  
> have managed to do some more complicated statistics
> such as  
> hierarchical partitioning of variance on an 80,000
> record dataset but  
> have to admit that drawing a simple bar plot I could
> do by hand is  
> proving extremely difficult!
> 
> I have Crawley's 'The R book' which is proving  a
> big help, but still  
> does not provide me with all of the information I
> need.
> 
> What I want to do:-
> I have a small dataset, with 'rate' as the dependent
> variable (y axis  
> variable) and two groups ('cat' and 'box') which I
> have calculated  
> the mean and standard error for and would like to
> display as a bar  
> plot. I would like to display the standard error for
> each group NOT a  
> pooled standard error (i.e. error bars will be
> different heights on  
> the two bars). In the Crawley book, he just repeats
> the same error  
> bars across all groups, and I don't know how to
> specify the different  
> error for each bar.
> 
> What I have managed to do so far:-
> -calculate mean and standard error
> -plots means with confidence intervals
> -plot means as bar plot but with no error bars or
> confidence intervals
> -everything except what I want to do!
> 
> I have learnt a lot about R but it is getting rather
> frustrating that  
> I can do complex GLMs but cannot do a simple plot in
> 4 hours! I have  
> migrated to R because I like the way it can do
> almost anything and  
> because I'm trying to go almost completely freeware
> as everytime I  
> move institution I run into trouble with getting
> software licenses  
> which also tend to be expensive. However, I'm not
> the most computer  
> literate person and have grown up with 'menus' and
> 'windows'.
> 
> Any help much appreciated as it will save me much
> time and frustration!
> 
> Dr. Katherine Jones
> Department of Biology,
> Carleton University
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
>



More information about the R-help mailing list