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

From: Dieter Menne <dieter.menne_at_menne-biomed.de>
Date: Mon, 10 Dec 2007 16:53:32 +0000 (UTC)

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



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 10 Dec 2007 - 17:28:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 10 Dec 2007 - 17:30:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.