[R] Using Sweave to generate multiple documents

Duncan Murdoch murdoch.duncan at gmail.com
Mon Jan 16 23:50:42 CET 2012


On 12-01-16 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?

I don't think it's very easy with plain Sweave, but there are several 
packages aimed at supporting large multi-file Sweave projects that could 
probably come close.  The main thing that you probably couldn't easily 
do is to have it all in one .Rnw file; Sweave produces one .tex file 
from one .Rnw input, and LaTeX normally produces only one output from 
one .tex input.

However, it should be easy to have 3 files that were processed by a 
single function call, and have them share data.  For example, take a 
look at the "project management" part of the vignette for my patchDVI 
package on R-forge.r-project.org.  Without a bit of programming, you'd 
end up with three .tex files which needed separate processing, but that 
extra bit of programming would be easy.

Duncan Murdoch



More information about the R-help mailing list