Skip to content
Prev 5499 / 21307 Next

[Bioc-devel] unexpected build and check error

On 04/04/2014 10:36 AM, Luo Weijun wrote:
I can reproduce this providing the path to the gage source tree

   tools::buildVignettes(dir="path/to/gage", quiet=FALSE)

you'll see that this builds the dataPrep vignette first, and then the gage 
vignette. It seems like dataPrep loads data bods from pathview into the global 
environment, and when the gage vignette is being processed it attempts to load 
an identically named data set into the (same) global environment.

The (partial) output of buildVignettes is in gage/vignettes/gage.tex; editing 
gage.Rnw to include a print(ls()) early in the vignette confirms that an object 
'bods' already exists.

It's surprising to me that R re-uses the same environment to build each 
vignette, and I'll take this up on the R-devel mailing list.

The data() function can arrange to load data into an arbitrary environment; for 
a function it seems better not to write to the global environment, and something 
like

   env = new.env(parent=emptyenv())
   obj = data("bods",envir=env)
   bods = env[[obj]]

is better.

Hopefully this helps to address your problem.

Martin