[R] Suppress getOptions() in Stangle

Derek Ogle DOgle at northland.edu
Wed Jan 6 22:18:34 CET 2010


Hello,

I am creating PDF handouts using Sweave for a beginner's R workshop.  I want to include the R code for the handout in an appendix as described (using the listings LaTeX package) as described in ...

http://n4.nabble.com/including-Sweave-tangled-code-in-Rnw-document-tp875112p875112.html

Whenever a graphic is created in this code the resulting Stangle code precedes the plotting code with a getOptions() call.  For example, this code in my RNW file ...

<<echo=FALSE,label=transLW,fig=TRUE,include=FALSE>>=
plot(logWT~logTL,data=dA)
@
\includegraphics[width=3in]{Figs/reg1-transLW}
produces the following lines in the Stangle "code" file


getOption("SweaveHooks")[["fig"]]()

plot(logWT~logTL,data=dA)



In hopes of getting the cleanest code possible for this beginner class I was wondering if anyone knew of a way to suppress the getOptions() code in the Stangle results.



Thanks in advance for any help.



More information about the R-help mailing list