From Greg.Snow at imail.org  Thu Feb 11 19:30:54 2010
From: Greg.Snow at imail.org (Greg Snow)
Date: Thu, 11 Feb 2010 11:30:54 -0700
Subject: [Rd] R crashes when setWinProgressBar is give a numeric value
 for label argument
In-Reply-To: <alpine.LFD.2.00.1002111755080.8747@gannet.stats.ox.ac.uk>
References: <B37C0A15B8FB3C468B5BC7EBC7DA14CC62F9A05A77@LP-EXMBVS10.CO.IHC.COM>
	<alpine.LFD.2.00.1002111755080.8747@gannet.stats.ox.ac.uk>
Message-ID: <B37C0A15B8FB3C468B5BC7EBC7DA14CC62F9A05EA3@LP-EXMBVS10.CO.IHC.COM>

Thanks,

I would be happy with an error that did not crash R, coercion just makes life a little easier, but I can live without that if you are not sure or there are reasons not to (speed being on possibility).

It looks like you just underestimated how stupid I could be.

Thanks,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
> Sent: Thursday, February 11, 2010 11:05 AM
> To: Greg Snow
> Cc: r-devel
> Subject: Re: [Rd] R crashes when setWinProgressBar is give a numeric
> value for label argument
> 
> Greg,
> 
> winProgressBar() has internal checks for the argument types, and for
> some unaccounted-for reason I omitted them in setWinProgressBar().  So
> 2) is easy (cut-and-paste).
> 
> I am less sure that we should add coercion, and sure that if we add it
> to setWinProgressBar() we should also add it to winProgressBar().  But
> as you suggested it, I've done so.
> 
> Thanks for the report.
> 
> Brian Ripely
> 
> On Wed, 10 Feb 2010, Greg Snow wrote:
> 
> > This problem can be seen by the following commands:
> >
> >> pb <- winProgressBar(max=1000, label='0')
> >> b <- 1
> >> setWinProgressBar(pb, b, label=b)
> >
> > This set of commands (on windows of course, XP in this case) causes R
> to crash.
> >
> > This is not strictly a bug since the documentation states that the
> label argument should be a character string and using as.character(b)
> does work properly.  But when I (and possibly others) forget this and
> use something like the above, having the whole R process crash seems a
> bit extreme.
> >
> > Possible responses:
> >
> > 1. ignore this and hope that after being punished for not remembering
> the correct syntax enough times I will eventually learn to do the
> correct thing.
> >
> > 2. add a check and generate an error if title or lab is not a
> character string (less severe punishment, I may learn eventually, but
> maybe not as quick).
> >
> > 3. add label <- as.character(label) and same idea for title, so that
> the above code works without the user needing to remember the
> as.character.  This may need a check for NULL values as well.
> >
> > 4.  Something else that I have not thought of.
> >
> > Number 1 would be easiest for R core, hardest on me.  Numbers 2 and 3
> have the potential drawback of slowing things down slightly.
> >
> > My sessionInfo()
> >
> >> sessionInfo()
> > R version 2.10.1 Patched (2010-02-08 r51108)
> > i386-pc-mingw32
> >
> > locale:
> > [1] LC_COLLATE=English_United States.1252
> > [2] LC_CTYPE=English_United States.1252
> > [3] LC_MONETARY=English_United States.1252
> > [4] LC_NUMERIC=C
> > [5] LC_TIME=English_United States.1252
> >
> > attached base packages:
> > [1] stats     graphics  grDevices utils     datasets  methods   base
> >
> > loaded via a namespace (and not attached):
> > [1] tools_2.10.1
> >>
> >
> > Same thing happens in non-patched 2.10.1
> >
> > Thanks,
> >
> >
> >
> > --
> > Gregory (Greg) L. Snow Ph.D.
> > Statistical Data Center
> > Intermountain Healthcare
> > greg.snow at imail.org
> > 801.408.8111
> >
> > ______________________________________________
> > R-devel at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
> 
> --
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] R crashes when setWinProgressBar is give a numeric value for label argument
Greg Snow