[R-pkg-devel] "Progress reports" for examples in packages --- SOLVED.

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Sun Jul 7 05:27:34 CEST 2019

This is why I only put localization variables in .Rprofile and am always putting such options into my project-specific scripts.

This may sound like I am a masochist, but I hate sharing my scripts with someone else contaminated with compatibility bombs like that.

On July 6, 2019 8:19:27 PM PDT, Rolf Turner <r.turner using auckland.ac.nz> wrote:
>Just thought it might be of interest were I to give a progress report
>( :-) ) on this problem.
>I managed to track down and fix what was going wrong.  It turns out
>the issue was "stringsAsFactors".  I *hate* stringsAsFactors being TRUE
>so I have a call to options() setting it to FALSE in my .Rprofile.
>But of course R CMD check sets it to TRUE.  In my code, I create at one
>point a one-row data frame.  I use a data frame so that the object is 
>consistent with appears in other contexts in the code.  I extracting
>entries of the data frame in question from other objects.  Some of
>entries are strings ... uh-oh!  When they get changed to factors and 
>then passed on to a function which passes them on to (e.g.) binomial() 
>they wind up taking values like, e.g., 1, where "logit" was what was 
>I had the function that calls binomial() wrapped up in a try() with 
>silent=TRUE, since there are occasional circumstances in which there 
>would be a "legitimate" fail (and I wanted to create a missing value if
>there was such a fail).  However there was *always* a fail due to the
>stringsAsFactors contretemps, so the overall result was useless and the
>repeat{ } loop repeated.  Endlessly.  When R CMD check was run.
>(But everything was of course just ducky when I ran the example "as 
>The fix, once I found the problem, was simple; just stick in a
>stringsAsFactors=FALSE in the relevant call to data.frame().
>Finding the problem, obvious as it is in retrospect, was a nightmare. 
>It required many many many attempts with cat() statements inserted at 
>various places (in accordance with the advice given by Ben Bolker).  I 
>had the devil's own time figuring out what to cat()!
>I found, once I'd tracked down which example was the culprit (by doing
>tail -f pkge-Ex.Rout), that I could use \dontrun{} on all of the
>examples and get the same puzzling behaviour.  This speeded up the 
>process considerably.
>Don't know if there is any message to take away from all of the 
>foregoing (other than that Rolf Turner is pretty stupid) but I thought 
>that some list members might find the story to be of interest.
>Rolf Turner

Sent from my phone. Please excuse my brevity.

More information about the R-package-devel mailing list