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

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Mon Dec 10 17:49:52 CET 2007


I think something like this would work.

Change your query to 

rs <- dbSendQuery(con, statement = paste("select * from treatdata where
name='", whichDevice,"'", sep = ""))

And then create a script like.

whichDevice <- "Device1"
Sweave("myfile.rnw")
whichDevice <- "Device2"
Sweave("myfile.rnw")

HTH,

Thierry

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be 
www.inbo.be 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

-----Oorspronkelijk bericht-----
Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org]
Namens Ptit_Bleu
Verzonden: maandag 10 december 2007 17:26
Aan: r-help op r-project.org
Onderwerp: [R] Sweave : change value in rnw file to generate multiple
"single"reports ?


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-mu
ltiple-%22single%22-reports---tp14256204p14256204.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help op 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.



More information about the R-help mailing list