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

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Tue Jul 2 22:25:35 CEST 2019


On 02/07/2019 5:31 a.m., Rolf Turner wrote:
> 
> Many thanks to Henrik Bengtsson and Martin Maechler for pointing out
> that I can monitor progress by looking at the file
> 
>       "mypkg.Rcheck/mypkg-Ex.Rout"
> 
> e.g. by using "tail -f".  This strategy indeed revealed where the hangup
> was happening.  I wrapped a line of the examples in \dontrun{} and
> checked the package again.  Now the checking completes in finite time! :-)
> 
> However I remain puzzled as to *why* the line in question induces a
> hangup.  When I load the package and run that same  line from the
> command line, a result is returned within about 5 seconds of "wall time"
> (or less).
> 
> Another strangeness:  The line prior to that which I wrapped in
> \dontrun{} took a very long time to return a result, although the
> command did eventually complete (after which everything ran swiftly).
> But when I run this same line from the command line it completes
> *instantaneously*.
> 
> Why on earth would commands be slow, or not execute at all, when run
> under the aegis of "R CMD check", but execute swiftly from the command line?
> 
> I think it would be unwise of me to ignore the fact that something
> strange is going on here, but I'm damned if I can see how to go about
> tracking the strangeness down so as to be able to remedy it.
> 
> My usual practice when trying to get a handle on something that I don't
> understand is to insert browsers() into the code at strategic points.
> See fortunes::fortune(158).  That's of no help in the current context in
> which the problem only arises when R CMD check is being run.
> 
> Can anyone suggest a clever means by which I might determine the
> "magnitude and direction of my stupidity"?

Normally "R CMD check pkg.tar.gz" isn't easily debugged, as you've 
found.  You can make it a bit easier by doing from the console what it 
does from the command line, using

  tools:::.check_packages("pkg.tar.gz")

Sometimes this helps.  I think it spawns separate R processes at a few 
points; if it's one of those that is hanging, you can at least see what 
the command line is, and run that part directly, possibly from the 
console.  Still not easy, but easier.

Duncan Murdoch



More information about the R-package-devel mailing list