[R] Using Sweave to generate multiple documents

Ramiro Barrantes ramiro at precisionbioassay.com
Wed Jan 18 16:51:25 CET 2012


Just an FYI regarding this question.  I found the answer on the DOCSTRIP, it allows you to create tags for different sections of your document, thus allowing one to generate multiple documents that share code.  You can see an article about this in the December 2011 issue of the R Journal, its the Lundholm article: http://journal.r-project.org/current.html
________________________________________
From: Michael Friendly [friendly at yorku.ca]
Sent: Monday, January 16, 2012 8:45 PM
To: Ramiro Barrantes
Cc: r-help at r-project.org
Subject: Re: Using Sweave to generate multiple documents

On 1/16/2012 4:20 PM, Ramiro Barrantes wrote:
> Hello,
>
> I tried looking for a Sweave-specific list but didn't find one, nor did I find an answer via google, so will send this question to the general R list.  Please feel free to point me in the right direction.
>
> I am using Sweave and would like to have a single .Rnw document that generates 1) a summary report, 2) a full report, 3) slides for a talk.  I think my material lends itself to have it all coming from one master document because a lot of the plots, writings, and calculations are shared, but I would need Sweave to generate separate files with me somehow pointing to what goes where.  Is this possible with Sweave?
>

Following up on Duncan, I think you are making it too hard to insist
that everything comes from a single .Rnw document, which would entail
an awful lot of conditionals at the latex or R level.

On the other hand, if you have large sections of the .Rnw that would be
shared across the summary report, full report or slides, you can always
put them in separate .Rnw files and then have very short master .Rnw
files that input them, as appropriate, using
\SweaveInput{sec1.Rnw}
\SweaveInput{sec2.Rnw}
...



More information about the R-help mailing list