Sweave is a function in the statistical programming language R that enables integration of R code into LaTeX or LyX documents.

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

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. This enables Sweave to be a cornerstone of Reproducible Research.

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