Skip to content

R crashes when setWinProgressBar is give a numeric value for label argument

3 messages · Greg Snow, Brian Ripley

#
This problem can be seen by the following commands:
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()
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,
#
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:

            

  
    
#
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,