From murdoch@dunc@n @end|ng |rom gm@||@com  Sun Jul  2 18:01:03 2023
From: murdoch@dunc@n @end|ng |rom gm@||@com (Duncan Murdoch)
Date: Sun, 2 Jul 2023 12:01:03 -0400
Subject: [Rd] Strange error in R CMD check --timings
Message-ID: <fb0340ef-f2f0-4b52-ae15-900d3cf2fdeb@gmail.com>

This SO post: https://stackoverflow.com/q/76583828 describes a strange R 
CMD check error.  Depending on the contents of a comment in one of the 
examples sections of a help page, an error like this could be triggered:

   > base::assign(".dptime", (proc.time() - get(".ptime", pos = 
"CheckExEnv")), pos = "CheckExEnv")
   > base::cat("read_net", base::get(".format_ptime", pos = 
'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", 
file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t")
   > ### * <FOOTER>
   > ###
   > cleanEx()
   > options(digits = 7L)
   > base::cat("Time elapsed: ", proc.time() - base::g
   + Error: unexpected end of input
   Execution halted

The code without the offending comment is available here:

   https://github.com/rob-ward-psych/iac

at revision c2f3529.  To add the offending comment, change line 318 of 
R/iac_networks.R to

   #' # Ken is a burglar in the Sharks, what is retrieved from his name

and run roxygen on the package, so the long comment ends up in the 
examples section of man/read_net.Rd instead of the empty comment that is 
there on Github.

At first it appeared to require devtools::check(), but in fact the error 
comes from R CMD check --timings .  One thing that may be related is 
that an earlier example had this code:

   file.edit(iac_example("what_where.yaml"))

If that line is skipped (by conditioning on interactive()), the error 
goes away.  But this might be unrelated, since deleting that comment 
also makes the error go away.

Duncan Murdoch



[Rd] Strange error in R CMD check --timings
Duncan Murdoch