[R] Sweave: option keep.source=TRUE and package cacheSweave

Renaud Lancelot renaud.lancelot at gmail.com
Sun Nov 7 11:36:00 CET 2010


Dear all,

When I use the cacheSweave package together with the Sweave option
keep.source = TRUE, all the LaTeX code before the Sweave code chunk is
included in the TeX file to be compiled. For example, with the
following Sweave file

\documentclass[12pt]{article}
\usepackage[nogin]{Sweave}

% Sweave options
\SweaveOpts{keep.source=TRUE, strip.white=TRUE, eps=FALSE, pdf=TRUE}

\begin{document}

Blabla.

<<optionsR, results=hide>>=
setCacheDir("./cache")
library(MASS)          ## just an example
@

\end{document}

I get the following TeX file:

\documentclass[12pt]{article}
\usepackage[nogin]{Sweave}

% Sweave options


\begin{document}

Blabla.

\begin{Schunk}
\begin{Sinput}
> \documentclass[12pt]{article}
> \usepackage[nogin]{Sweave}
>
> % Sweave options
> \SweaveOpts{keep.source=TRUE, strip.white=TRUE, eps=FALSE, pdf=TRUE}
>
> \begin{document}
>
> Blabla.
>
> <<optionsR, results=hide>>=
> setCacheDir("./cache")
> library(MASS)          ## just an example
\end{Sinput}
\end{Schunk}

\end{document}

When I set option keep.source = FALSE, the result is as expected. Is
there any possibility to use keep.source = TRUE with cacheSweave?


> sessionInfo()
R version 2.12.0 Patched (2010-10-28 r53459)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252
[3] LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252

attached base packages:
[1] tools     stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] MASS_7.3-8        cacheSweave_0.4-4 stashR_0.3-3      filehash_2.1-1
[5] fortunes_1.4-0

loaded via a namespace (and not attached):
[1] digest_0.4.2


-- 
Renaud Lancelot
EDEN Project, coordinator
http://www.eden-fp6project.net/

UMR CIRAD-INRA "Contrôle des maladies animales exotiques et émergentes"
Joint research unit "Control of emerging and exotic animal diseases"

CIRAD, Campus International de Baillarguet TA A-DIR / B
F34398 Montpellier
http://umr-cmaee.cirad.fr/

Tel.  +33 4 67 59 37 17  -  Fax  +33 4 67 59 37 95
Secr. +33 4 67 59 37 37  - Cell. +33 6 77 52 08 69



More information about the R-help mailing list