package vignettes build in the same R process?
On 08/11/2014, 3:29 AM, Wolfgang Huber wrote:
Il giorno Nov 2, 2014, alle ore 16:10 GMT+1, Duncan Murdoch <murdoch.duncan at gmail.com> ha scritto:
On 01/11/2014, 8:44 PM, Martin Morgan wrote:
If I understand correctly, all vignettes in a package are built in the same R
process. Global options, loaded packages, etc., in an earlier vignette persist
in later vignettes. This can introduce user confusion (e.g., when a later
vignette builds successfully because a package is require()'ed in an earlier
vignette, but not the current one), difficult-to-identify bugs (e.g., when
a setting in an earlier vignette influences calculation in a latter vignette),
and misleading information about reproducibility (e.g., when the sessionInfo()
of a later vignette reflects packages used in earlier vignettes).
I believe the relevant code is at
src/library/tools/R/Vignettes.R:505
output <- tryCatch({
## FIXME: run this in a separate process
engine$weave(file, quiet = quiet)
setwd(startdir)
find_vignette_product(name, by = "weave", engine = engine)
}, error = function(e) {
stop(gettextf("processing vignette '%s' failed with diagnostics:\n%s",
file, conditionMessage(e)), domain = NA, call. = FALSE)
})
Is building of each vignette in separate processes a reasonable feature request?
I'm not sure. It's not perfect: users may still see different output than the package contains, because when they run the vignette it will see their system state, but at least it gives them a way to get the identical output. On the other hand, they already have a way to do that: just build the whole package. Overall I'd say it's probably a good idea.
Let the perfect be the enemy of the good? Martin?s proposed improvement would eliminate unnecessary complexity and a lot of potential (and actual) confusion.
What are you talking about? I didn't object to Martin making this change, I was just pointing out that it is only a good idea, not a perfect one. Duncan Murdoch
Wolfgang Huber
I would prefer a way to detect and warn when vignette output depends on the state outside the vignette, but that looks hard to do. Duncan Murdoch
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel