[R] Sweave question: prevent expansion of unevaluated reused code chunk

Seth Falcon sfalcon at fhcrc.org
Wed Mar 14 15:48:11 CET 2007


"Kevin R. Coombes" <krc at mdacc.tmc.edu> writes:
> [2] You are also correct that there is no advantage if I just call
> them "chunk1" and "chunk2". But if I call them something more
> interesting, like "perform.quantile.normalization" or
> "truncate.and.log.transform",
> then I can use this structure to explain the algorithm at a higher
> level.  If you go back to Knuth's original literate programming
> examples, this is exactly how he presents his examples. For instance,
> on page 104 of the "Literate Programming" book, he has

I suspect it would not be too hard to write an Sweave driver that
would respond to an expand=FALSE argument in the way you want. -- But
I'm not certain.  I've never used nested code chunks (!) and that may
make such a modification difficult.

+ seth



More information about the R-help mailing list