[R] Sweave question

Duncan Murdoch murdoch.duncan at gmail.com
Sun Nov 14 15:58:10 CET 2010


On 13/11/2010 10:31 PM, Ralf B wrote:
> Thank you. The article you cited explains on the last page how this is
> done and shows how Sweave is run from within R and it says that it
> creates the .tex file.
>
> My last remaining question is now if there is a way to execute this
> Sweave tex output by executing Latex from R. In other words, what is
> the command to execute latex from within R. Or do I perhaps think to
> complcated and there is a single command to create the tex and the
> pdf/ps in a single step? At the end, I would like to create everything
> between the Sweave document and the final pdf/ps output from within R
> without the need to make external calls.

See SweavePDF() in the patchDVI package on R-forge.

Duncan Murdoch

>
> Ralf
>
>
> On Sat, Nov 13, 2010 at 4:29 PM, Johannes Huesing<johannes at huesing.name>  wrote:
>> 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")
>>
>> ______________________________________________
>> 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.



More information about the R-help mailing list