[R] plot a BARPLOT with sd deviation bar up and down

mlell08 mlell08 at googlemail.com
Fri Mar 23 21:21:19 CET 2012


Hello,

I think there's no function in R to print error bars.
I once found one in a blog which I'm using.

errorbar <- function(x, y, upper, lower=upper, length=0.02, vert=TRUE, ...){
  if(!doPlot) return()
  if(length(x) != length(y) | length(y) !=length(lower) | length(lower)
!= length(upper))
    stop("vectors must be same length")
  if(vert){
    arrows(x, y+upper, x, y-lower, angle=90, code=3, length=length, ...)
  }else{
    arrows(x+upper, y, x-upper, y, angle=90, code=3, length=length, ...)
  }
}

Regards!



More information about the R-help mailing list