[R] Sweave : change value in rnw file to generate multiple "single" reports ?

Dieter Menne dieter.menne at menne-biomed.de
Mon Dec 10 17:53:32 CET 2007


Ptit_Bleu <ptit_bleu <at> yahoo.fr> writes:

... 
> Is there a way to pass arguments to Sweave like Sweave("myfile.rnw",
> namevar="Device2") and it will change namevar by Device2 into the file
> myfile.rnw before creating the .tex file ?
> Or is it possible to do it via another language, that is: loading the rnw
> file, modifying it, saving it and finally calling Sweave ?


You can set an environment variable in the system (SET DELTA=...), and read it
in from R:

Sys.getenv("DELTA") 

Works for Windows with a rather inconsistent implementation of environment
strings, so it should work the better with Linux.

Dieter



More information about the R-help mailing list