Hi! Could you tell me how I can draw a graph with error bars? Sorry, I don't use R that often and I couldn't find it easily in the documentation. TIA -- myriam -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi, Take a look at http://finzi.psych.upenn.edu/R/Rhelp02/archive/4124.html and its thread. You may want to bookmark Jonathan Baron's page, http://finzi.psych.upenn.edu/search.html , which lets you search the r-help archive and R documentations. You can find more information about error bars there. Hope this helps, Kevin ------------------------------------------------ Ko-Kang Kevin Wang Post Graduate PGDipSci Student Department of Statistics University of Auckland New Zealand www.stat.auckand.ac.nz/~kwan022 ----- Original Message ----- From: "Myriam Abramson" <mabramso at gmu.edu> To: <r-help at stat.math.ethz.ch> Sent: Sunday, October 06, 2002 5:09 PM Subject: [R] error bars in line plots> Hi! > > Could you tell me how I can draw a graph with error bars? > Sorry, I don't use R that often and I couldn't find it easily in the > documentation. > > TIA > > > -- > myriam > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-> r-help mailing list -- Readhttp://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html> Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. _._>-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On 6 Oct 2002, Myriam Abramson wrote: |Hi! | |Could you tell me how I can draw a graph with error bars? |Sorry, I don't use R that often and I couldn't find it easily in the |documentation. There is no errorbars function in the package. But you may easily construct your own using segments(). I add my own versions below (actually, why not put something similar into the base package?). You may use it as: plot(x,y) errorbars(x,y, dy=dy) The second function is for using with matplot(). Ott ----------------------- errorbars <- function(x, y, dy=NULL, dx=NULL, ...) { if(dy) { segments(x, y-dy, x, y+dy, ...) } if(dx) { segments(x-dx, y, x+dx, y, ...) } } materrorbars <- function(x, y, dy=NULL, dx=NULL, col=par("col"), lty=par("lty")) { M <- ncol(y) if(is.matrix(x)) N <- nrow(x) else { N <- length(x) x <- matrix(x, N, M) } karv <- rep(col, length.out=M) joon <- rep(lty, length.out=M) if(!is.null(dy)) { for(i in seq(M)) { segments(x[,i], y[,i]-dy[,i], x[,i], y[,i]+dy[,i], col=karv[i], lty=joon[i]) } } if(!is.null(dx)) { for(i in seq(M)) { segments(x[,i]-dx[,i], y[,i], x[,i]+dx[,i], y[,i], col=karv[i], lty=joon[i]) } } } -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
barsd <- function(barmatrix, sdmatrix, ...) { r <- barplot(barmatrix, beside= T, ...) if(!missing(sdmatrix)) arrows(r, barmatrix, r, barmatrix+sdmatrix, length= 0.05, angle=90) }> Date: 06 Oct 2002 00:09:28 -0400 > From: Myriam Abramson > Subject: [R] error bars in line plots > > Hi! > > Could you tell me how I can draw a graph with error bars? > Sorry, I don't use R that often and I couldn't find it easily in the > documentation. > > TIA >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi, >> Could you tell me how I can draw a graph with error bars?>>>>> "KKW" == Ko-Kang Kevin Wang <Ko-Kang at xtra.co.nz> writes:KKW> Hi, Take a look at KKW> http://finzi.psych.upenn.edu/R/Rhelp02/archive/4124.html and KKW> its thread. I just had a look at this page and expanded the examples a bit: ##Sample data: mydat <- data.frame(x=1:10, y=1:10, dy=rnorm(10)) attach(mydat) ##Style of errorbars: myangle=90 #Angle from shaft to edge of arrow head. mylength=0.2#Length of arrow head in inches (!!!) ##One--sided errorbars: plot(x,y,ylim=range(y,y+dy)) arrows(x,y,x,y+dy,angle=myangle,length=mylength) ##Two--sided errorbars: plot(x,y,ylim=range(y-dy,y+dy)) arrows(x,y-dy,x,y+dy,code = 3,angle=myangle,length=mylength) HTH Volker -- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Try the plotCI() and/or plotmeans() functions in the 'gregmisc' package. -Greg> -----Original Message----- > From: Myriam Abramson [mailto:mabramso at gmu.edu] > Sent: Sunday, October 06, 2002 12:09 AM > To: r-help at stat.math.ethz.ch > Subject: [R] error bars in line plots > > > Hi! > > Could you tell me how I can draw a graph with error bars? > Sorry, I don't use R that often and I couldn't find it easily in the > documentation. > > TIA > > > -- > myriam > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. > -.-.-.-.-.-.-.-.- > r-help mailing list -- Read > http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: > r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. > _._._._._._._._._ >LEGAL NOTICE Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
At 09:23 07/10/02 +0200, you wrote:>On 6 Oct 2002, Myriam Abramson wrote: > > |Hi! > | > |Could you tell me how I can draw a graph with error bars? > |Sorry, I don't use R that often and I couldn't find it easily in the > |documentation. >and Ott Toomet responded >There is no errorbars function in the package. But you may easily construct >your own using segments(). I add my own versions below (actually, why not >put something similar into the base package?).When I first met the problem I felt error bars should be added ... however different disciplines have different ideas on what confidence intervals should be and a 'packaged' version of 'error bars' may be less than helpful. Maybe a short script should be put somewhere accessable? I built my own script in a couple of minutes based on previous solutions given by readers of r-help ... . It is actually a nice beginner exercise in R programming, taking a few moments with every prospect of swift success, Richard Rowe Senior Lecturer Department of Zoology and Tropical Ecology, James Cook University Townsville, Queensland 4811, Australia fax (61)7 47 25 1570 phone (61)7 47 81 4851 e-mail: Richard.Rowe at jcu.edu.au http://www.jcu.edu.au/school/tbiol/zoology/homepage.html -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._