Sweave

From Wikipedia, the free encyclopedia

Sweave is a function in the statistical programming language R that enables integration of R code into LaTeX documents. The purpose is "to create dynamic reports, which can be updated automatically if data or analysis change" (Leisch, 2002, p. 28).

The data analysis is performed at the moment of writing the report, or more exactly, at the moment of compiling the Sweave code with Sweave (i.e., essentially with R) and subsequently with LaTeX. This can facilitate the creation of up-to-date reports for the author.

Because the Sweave files together with any external R files that might be sourced from them and the data files contain all the information necessary to trace back all steps of the data analyses, Sweave also has the potential to make research more transparent and reproducible to others[citation needed]. However, this is only the case to the extent that the author makes the data and the R and Sweave code available. If the author only publishes the resulting PDF document or printed versions thereof, a report created using Sweave is no more transparent or reproducible than the same report created with other statistical and text preparation software.

[edit] Sources

  • Leisch, F. (2002). Sweave, Part I: Mixing R and LaTeX: A short introduction to the Sweave file format and corresponding R functions. R News Vol. 2(3), 28-31.