Skip to content
Prev 47987 / 63424 Next

Package vignettes share the same environment?

On 05/04/2014, 2:24 PM, Martin Morgan wrote:
It's not just the environment that gets shared:  if you run 
buildVignette or buildVignettes in an R session, other aspects of the 
session (e.g. options() settings) will also be inherited by the 
vignette.  The way "R CMD build" handles this is to start a new R 
process to build the vignettes.

Currently it builds all vignettes in one process, rather than starting a 
separate process for each, which is why you see the x variable carry 
from one vignette to another.  I think it has been like this for quite a 
while, because on some platforms (e.g. Windows), starting a new process 
is quite slow.

I don't know if any other packages than gage currently depend on this 
behaviour.  It does sound confusing for the reader, but I don't think it 
breaks reproducibility:  after all, if a user has the package, they have 
all the vignettes, not just one.  If they just have the vignette, then 
they might not have the functions in the package that it needs, so 
they've already lost reproducibility.

Duncan Murdoch