[R] Sweave question

Johannes Huesing johannes at huesing.name
Sat Nov 13 22:29:46 CET 2010


Ralf B <ralf.bierig at gmail.com> [Sat, Nov 13, 2010 at 10:03:49PM CET]:
> It seems that Sweave is supposed to be used from Latex and R is called
> during the LaTeX compilation process whenever R chunks appear. 

This is not how it works.

In the first page of 
http://www.statistik.lmu.de/~leisch/Sweave/Sweave-Rnews-2002-3.pdf
that the file is first processed by R before it can be typeset by
LaTeX.

> What
> about the other way round? I would like to run it triggered by R. Is
> this possible? 

To my understanding this is how it's done.

> I understand that this does not correspond to the idea
> of literate programming since it means that there is R code running
> outside the document, 

You lost me here.

> but for my practical approach, I would like to
> use Sweave more like a report extension at the end of my already
> existing R scripts that combined a number of diagrams to a pdf file.
> 
> My second question is, does Sweave create a potential performance
> bottleneck when used with very big data analysis compared with when
> using R directly?
> 

Not really, because the only overhead is tangling the Sweave file.
If it is very big, you may want to process only the parts you have
changed last. The package weaver seems to come in handy then, see
http://bioconductor.org/packages/2.6/bioc/vignettes/weaver/inst/doc/weaver_howTo.pdf
-- 
Johannes Hüsing               There is something fascinating about science. 
                              One gets such wholesale returns of conjecture 
mailto:johannes at huesing.name  from such a trifling investment of fact.                
http://derwisch.wikidot.com         (Mark Twain, "Life on the Mississippi")



More information about the R-help mailing list