[R] help

Marc Schwartz mschwartz at medanalytics.com
Fri Feb 21 14:41:07 CET 2003


>-----Original Message-----
>From: r-help-admin at stat.math.ethz.ch 
>[mailto:r-help-admin at stat.math.ethz.ch] On Behalf Of Thanjavur 
>Bragadeesh
>Sent: Monday, February 10, 2003 4:08 PM
>To: r-announce at stat.math.ethz.ch
>Subject: [R] help
>
>
>
>Hi,
>
>help.I would like to plot the mean and standard deviation 
>against a factor 
>in the xaxis- in other words I want an errorplot. I also want 
>to put the 
>standard deviation like a "T" on top of a barplot.  How can do 
>this in R
>
>Bragadeesh

Look at the barplot2() function in the gregmisc package on CRAN.

A quick example using barplot2() and faked numbers:


library(gregmisc)
barplot2(c(5, 8, 4, 6, 9), plot.ci = TRUE, ci.l = c(5, 8, 4, 6, 9),
ci.u = c(5.5, 8.3, 4.25, 6.7, 10.5))


This will give you 5 vertical bars, with the upper bounds of the
confidence intervals plotted on top of the bars. Note that I have
specified that the lower bounds are the same as the bar values, which
results in no lower intervals being plotted.  If you want both upper
and lower bounds plotted, use appropriate values for the 'ci.l'
argument.

There are other options for axis configuration, grid lines and so
forth in barplot2() if you should need them.

Hope that helps,

Marc Schwartz




More information about the R-help mailing list