From mtmorgan at fredhutch.org  Sun Nov  2 01:44:10 2014
From: mtmorgan at fredhutch.org (Martin Morgan)
Date: Sat, 01 Nov 2014 17:44:10 -0700
Subject: [Rd] package vignettes build in the same R process?
Message-ID: <54557E5A.7090800@fredhutch.org>

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?

Martin
-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



[Rd] package vignettes build in the same R process?
Martin Morgan