-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf
Of raz
Sent: Wednesday, November 27, 2013 7:23 AM
To: r-help at r-project.org
Subject: [R] Conditional error bars
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]]