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

Berwin A Turlach statba at nus.edu.sg
Wed Mar 14 04:47:29 CET 2007


G'day Kevin,

On Tue, 13 Mar 2007 20:18:11 -0500
"Kevin R. Coombes" <krc at mdacc.tmc.edu> wrote:

> [1] In the example I presented, you're right; I can just use a
> verbatim environment. In the following more complicated example [...]
> I would still want to be able to see the outline of what is going on, 
> and a verbatim environment wouldn't work.

If you want to have a literate programming environment in R, in
particular one where you can refer to code chunks that are only defined
later in the document, then I would investigate the package relax by
Peter Wolf.  See:

	http://www.wiwi.uni-bielefeld.de/~wolf/software/relax/relax.html

And, for an example output just like you what you want:

	http://www.wiwi.uni-bielefeld.de/~wolf/software/relax/hello-world.pdf

HTH.

Cheers,

	Berwin

=========================== Full address =============================
Berwin A Turlach                            Tel.: +65 6515 4416 (secr)        
Dept of Statistics and Applied Probability        +65 6515 6650 (self)        
Faculty of Science                          FAX : +65 6872 3919               
National University of Singapore     
6 Science Drive 2, Blk S16, Level 7          e-mail: statba at nus.edu.sg
Singapore 117546                    http://www.stat.nus.edu.sg/~statba



More information about the R-help mailing list