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

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Mon, 10 Dec 2007 11:44:02 -0500

The ability to pass arguments on the

R CMD Sweave

line is something I would very much like to have as well.

Currently you need to create a shell or batch file that accepts the arguments, place those into environment variables using shell or batch code and then run sweave. R code in your swevae file would then read the environment variables using Sys.getenv.

On Dec 10, 2007 11:25 AM, Ptit_Bleu <ptit_bleu_at_yahoo.fr> wrote:
>
> Hello,
>
> I'm still trying to make the life of my colleagues easier. Nice, isn't it ?
> At the moment, I'm looking for a way to generate multiple "single report".
> In fact I have a .rnw file which send a query to a MySQL database
> (rs<-dbSendQuery(con, statement="select * from treatdata where
> name='Device1'")
>
> But of course my colleagues have many devices and don't want to enter the
> rnw file to change the name of the device.
>
> 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 ?
>
> Whatever the solution, I need you help. In advance thank you.
> Ptit Bleu.
> --
> View this message in context:
http://www.nabble.com/Sweave-%3A-change-value-in-rnw-file-to-generate-multiple-%22single%22-reports---tp14256204p14256204.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



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:04:34 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 Tue 11 Dec 2007 - 12:30:17 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.