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

From: Greg Snow <Greg.Snow_at_imail.org>
Date: Tue, 11 Dec 2007 10:32:48 -0700

I'm not Uwe, but here are some of the things to try if you want to do this fully in R.

Look at the help for scan, one approach to reading in a .rnw file is to use scan, but set it to read each row of the file as a character matrix. The 'see also' section of the scan help page has some other functions that could be used to read in the file as well.

Modify the read in character strings with the sub or gsub functions.

Use cat (with a file argument) to write the character strings back to a file.

Also look at the commandArgs function for one way to pass options (the device name(s)) to your R script.

You may also want to read (or reread) the "Invoking R" section of "An Introduction to R".

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow_at_imail.org
(801) 408-8111
 
 


> -----Original Message-----
> From: r-help-bounces_at_r-project.org
> [mailto:r-help-bounces_at_r-project.org] On Behalf Of Ptit_Bleu
> Sent: Tuesday, December 11, 2007 8:05 AM
> To: r-help_at_r-project.org
> Subject: Re: [R] Sweave : change value in rnw file to
> generate multiple "single" reports ?
>
>
> Dear Uwe,
>
> Could you please give me the name of the function to open, to
> modify and to save a r script ?
> Just the name and I will look for the way to use them.
>
> And if you have a link explaining how to use user customized
> variables from an environment variable, it will be very
> helpful (as it is completely new to me).
>
> Thanks in advance,
> Ptit Bleu.
>
> ------------------------------------------------
>
>
> Within or before SWeave, you can use R.
> Hence you can write some R function that first changes the
> rnw and runs SWeave thereafter, or even better, write
> something in your SWeave code that reads a user customized
> variables, e.g. from an environment variable or from some text file.
>
> Uwe Ligges
> --
> View this message in context:
> http://www.nabble.com/Sweave-%3A-change-value-in-rnw-file-to-g
> enerate-multiple-%22single%22-reports---tp14256204p14275809.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 Tue 11 Dec 2007 - 17:36:11 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 Wed 12 Dec 2007 - 09:30:19 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.