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

Greg Snow Greg.Snow at imail.org
Tue Dec 11 18:32:48 CET 2007


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.
> 



More information about the R-help mailing list