[R] Error Bar Issues

Joris Meys jorismeys at gmail.com
Sun Jun 6 00:15:47 CEST 2010


you can't refer to an argument within a function call. Try

uiw <- Saline[,3]

plotCI(x=Saline [,1],y=Saline [,2], uiw=uiw, liw=uiw, err=y, pch=21,
pt.bg=par("bg"), cex=1.5, lty=1, type="o", gap=0, sfrac=0.005,
xlim=c(-21,340),xaxp=c(-20,320,11), xlab="Time (min)", ylim=c(0,12),
yaxp=c(0,12,11), ylab="Arterial Plasma Acetaminophen (µg/mL)", las=1,
font.lab=2, add=TRUE)

Cheers
Joris

On Sat, Jun 5, 2010 at 6:09 PM, beloitstudent <schurrk at beloit.edu> wrote:
>
> Hello all,
>
> I am an undergraduate student who is having syntax issues trying to get
> error bars on my graph.
>
> This is the data, which I assigned the name "Saline" to.
>  Time       Average       SEM
> 1   -20      0.000000     0.0000000
> 2
> 3    30      0.000000     0.0000000
> 4    45      3.227902     0.7462524
> 5    60      5.066664     1.1623944
> 6    80      6.107491     1.5027762
> 7   110     6.968231     1.3799637
> 8   140     7.325713     1.2282053
> 9   200     7.875194     1.1185175
> 10  260    6.513927     0.5386359
> 11  320    4.204342     0.6855906
>
> This is the command that I typed in to get my error bars.
>
> plotCI(x=Saline [,1],y=Saline [,2], uiw=Saline [,3], liw=uiw, err=y, pch=21,
> pt.bg=par("bg"), cex=1.5, lty=1, type="o", gap=0, sfrac=0.005,
> xlim=c(-21,340),xaxp=c(-20,320,11), xlab="Time (min)", ylim=c(0,12),
> yaxp=c(0,12,11), ylab="Arterial Plasma Acetaminophen (µg/mL)", las=1,
> font.lab=2, add=TRUE)
>
> And this is the error message I keep getting
> Error in plotCI(x = Saline[, 1], y = Saline[, 2], uiw = Saline[, 3], liw =
> uiw,  :
>  object 'uiw' not found
> In addition: Warning message:
> In if (err == "y") z <- y else z <- x :
>  the condition has length > 1 and only the first element will be used
>
> Now, to me, the command seems correct.
> I want the error bars to show up where the points on my graph are...so the x
> coordinates should be my time (aka Saline [1]) and the y coordinates should
> be my Averages (aka Saline [2])  and my upper and lower limits to my
> confidence interval should be the SEM from Saline [3], but something is
> wrong with this and I cannot figure out what it is.  If anyone has
> suggestions I would be very grateful.  Thanks for your help!
>
> beloitstudent
> --
> View this message in context: http://r.789695.n4.nabble.com/Error-Bar-Issues-tp2244335p2244335.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



-- 
Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

tel : +32 9 264 59 87
Joris.Meys at Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php



More information about the R-help mailing list