[R] standard deviation in barplots

Marc Schwartz MSchwartz at mn.rr.com
Thu Sep 1 15:24:41 CEST 2005


On Thu, 2005-09-01 at 15:00 +0200, Knut Krueger wrote:
> 
> Sean Davis schrieb:
> 
> >I think barplot2 in the gregmisc (gplots) bundle will do that.
> >
> >Sean
> >
> >  
> >
> Ok thankÂ´s but I've got an error and do not found the solution:
> 
> 
> ci.l
>  [1] 304.09677 202.49907   0.00000  63.14547   0.00000   0.00000   0.00000
>  [8]   0.00000   0.00000   0.00000
> ci.h
>  [1] 633.50323 426.10093  45.12493 344.85453 196.19980 198.17632 208.96365
>  [8]  76.49691   0.00000   0.00000
>  xrow
>  [1] 468.8 314.3  20.1 204.0  96.0  96.0 115.0  36.0   0.0   0.0
> barplot2(xrow,plot.ci=TRUE,ci.l=ci.l,ci.h=ci.h)
> 
> Knut


Presumably, you are getting:

> barplot2(xrow, plot.ci = TRUE, ci.l = ci.l, ci.h = ci.h)
Error in barplot2.default(xrow, plot.ci = TRUE, ci.l = ci.l, ci.h =
ci.h) : 
	confidence interval values are missing



There is an error in your function call. The argument 'ci.h' is
incorrect, as it should be 'ci.u'. Thus, use:


ci.l <- c(304.09677, 202.49907, 0.00000, 63.14547,
          0.00000, 0.00000, 0.00000, 0.00000,
          0.00000, 0.00000)

ci.u <- c(633.50323, 426.10093, 45.12493, 344.85453,
          196.19980, 198.17632, 208.96365, 76.49691,
          0.00000, 0.00000)

xrow <- c(468.8, 314.3, 20.1, 204.0, 96.0, 96.0,
          115.0, 36.0, 0.0, 0.0)

barplot2(xrow, plot.ci = TRUE, ci.l = ci.l, ci.u = ci.u)


HTH,

Marc Schwartz




More information about the R-help mailing list