I'm trying to tie up the loose ends of a package, and I'm pretty much down to just the vignettes. I have four vignettes in the package. For references we'll call them Vignettes A - D. When I run R CMD check
, I get the error
Error: processing vignette 'Vignette A.Rmd' failed with diagnostics:
'what' must be a character string or a function
However, anytime I process Vignette A by using the knit button in R Studio, the document compiles just fine.
So I started playing around and eventually, I found that R CMD check
fails anytime I have both Vignettes A and C in the package. But any time I remove either one of those two vignettes, R CMD check
passes with no errors.
I haven't any clue where to start on this one. Any ideas on what could be the problem with these two files coexisting in a package?
I'm using R 3.2.0. The package in question is in the development branch at Github
Output from .Rcheck log file
* checking files in 'vignettes' ... OK
* checking examples ... OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in 'inst/doc' ... WARNING
Package vignettes without corresponding PDF/HTML:
'DecisionNetworks.Rmd'
'GettingStartedWithHydeNet.Rmd'
'HydeNetPlots.Rmd'
'WorkingWithHydeNetObjects.Rmd'
* checking running R code from vignettes ... OK
* checking re-building of vignette outputs ... NOTE
Error in re-building vignettes:
...
Loading required package: nnet
Loading required package: rjags
Loading required package: coda
Linked to JAGS 3.4.0
Loaded modules: basemod,bugs
Quitting from lines 173-176 (WorkingWithHydeNetObjects.Rmd)
Error: processing vignette 'WorkingWithHydeNetObjects.Rmd' failed with diagnostics:
'what' must be a character string or a function
Execution halted
Yuhui's hint got me to the solution. At first, I ran
knitr::knit('vignettes/WorkingWithHydeNetObjects.Rmd')
and everything worked fine. Then I tried runningknit
on the other vignette with the coexistence problem and found no errors. Then I ranknit
onWorkingWithHydeNetObjects.Rmd
again, and this time the error was produced.traceback
identified the error as coming fromdo.call
. I was passing a missing argument todo.call
when it should have been passing a character string. The behavior of the functions was changed by changing and option in the other vignette.So the moral of the story is not to assume that each vignette will be built in its own environment. Any options you set in one vignette will be carried over into subsequent vignettes.