Skip to content

Error.bars

3 messages · Sueli Rodrigues, jim holtman, Frank E Harrell Jr

#
Hi,
I'm studying the Michael J. Crawley book (Statistics An Introduction using
R)and I'm trying to reproduce one example (page 168) for plot a barplot
with error bars, but when I put the function I receive the following
message. Please, could someone told me what's wrong?

error.bars=function(yv,z,nn){xv=barplot(yv,ylim=c(0,(max(yv)+max(z))),names=nn,ylab=deparse(substitute(yv)))g=(max(xv)-min(xv))/50
for(i in
1:length(xv)){lines(c(xv[i],xv[i]),c(yv[i]+z[i],yv[i]-z[i]))lines(c(xv[i]-g,xv[i]+g),c(yv[i]+z[i],yv[i]+z[i]))lines(c(xv[i]-g,xv[i]+g),c(yv[i]-z[i],yv[i]-z[i]))}}

Erro: unexpected symbol in
"error.bars=function(yv,z,nn){xv=barplot(yv,ylim=c(0,(max(yv)+max(z))),names=nn,ylab=deparse(substitute(yv)))g"


Sueli Rodrigues

Eng. Agr?noma - UNESP
Mestranda - USP/ESALQ
PPG-Solos e Nutri??o de Plantas
Fones (19)93442981
      (19)33719762
#
It would appear there is not a carriage return in the sequence
')))g=";  I assume that was the unexpected character.  Better
formatting would be useful.
On Wed, Mar 11, 2009 at 7:49 PM, Sueli Rodrigues <srodrigu at esalq.usp.br> wrote:

  
    
#
Sueli Rodrigues wrote:
This is the notorious "dynamite plot" which causes distorted
perceptions, has an arbitrary base, and other problems.  See 
http://biostat.mc.vanderbilt.edu/DynamitePlots for more
information.

Frank