[Rd] Sweave errors during package building
Claudia Beleites
cbeleites at units.it
Tue Aug 4 23:00:37 CEST 2009
Dear all,
I just spent quite a while fixing a weird error in my vignettes while doing
R CMD build and R CMD check
R CMD Sweave ran fine, though.
The cause turned out to be:
1. I have a data set flu,
2. and a corresponding vignette explaining things one can do with that
object. This vignette creates another object flu (which masks the packages
one).
3. Now when the next vignette is processed, this object created by the first
vignette still exists, and still masks the packaged data set.
I was assuming that the building and checking processes are like R CMD Sweave,
but this is not the case: they are like Sweave inside R, which will also
change objects in the workspace (as I now know, see the example).
Maybe I didn't enough RTFM, but I was completely unaware of that before.
Would it be a good idea to have a few words about this in the FAQ and in the
help page?
Claudia
file testsweave.Rnw:
<<test>>=
a <- 3
b <- 1
@
now in R:
> a <- 4
> a
[1] 4
> b
Error: object 'b' not found
> Sweave ("testsweave.Rnw")
Writing to file testsweave.tex
Processing code chunks ...
1 : echo term verbatim (label=test)
You can now run LaTeX on 'testsweave.tex'
> a
[1] 3
> b
[1] 1
>
--
Claudia Beleites
Dipartimento dei Materiali e delle Risorse Naturali
Università degli Studi di Trieste
Via Alfonso Valerio 6/a
I-34127 Trieste
phone: +39 0 40 5 58-37 68
email: cbeleites at units.it
More information about the R-devel
mailing list