How can I condition any error bar function that use the arrows() function, such as 'CI.plot' (see example below) or 'error.bars', to draw only upper error bar (upper CI) if the bar value (mean) is positive and the lower error bar (lower CI) if bar value is negative?
CI.plot <- function(mean, se,length, ylim=c(-5, max(CI.H)), ...) { CI.H <- mean+se CI.L <- mean-se xvals <- barplot(mean, ylim=ylim, ...) # Plot bars arrows(xvals, mean, xvals, CI.H, angle=90,length=length) arrows(xvals, mean, xvals, CI.L, angle=90,length=length) } CI.plot(D,SE,0.01) thanks, -- \m/ [[alternative HTML version deleted]] ______________________________________________ R-help@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.