Automatic generation of reports by mixing word processing markup (like
latex) and S code. The S code gets replaced by its output (text or
graphs) in the final markup file. This allows a report to be re-generated
if the input data change and documents the code to reproduce the
analysis in the same file that also produces the report. Sweave combines the documentation and code chunks together (or
their output) into a single document. Stangle extracts only
the code from the Sweave file creating an S source file that can be
run using source. (Code inside \Sexpr{}
statements is ignored by Stangle.)
Stangle is just a wrapper to Sweave specifying a
different default driver. Alternative drivers can be used: the CRAN
package \href{https://CRAN.R-project.org/package=#1}{\pkg{#1}}cacheSweavecacheSweave and the Bioconductor package weaver
both provide drivers based on the default driver
RweaveLatex which incorporate ideas of caching
the results of computations on code chunks.
Environment variable SWEAVE_OPTIONS can be used to override the
initial options set by the driver: it should be a comma-separated set
of key=value items, as would be used in a \SweaveOpts
statement in a document.
Non-ASCII source files must contain a line of the form
\usepackage[foo]{inputenc}
(where foo is typically latin1, latin2, utf8 or
cp1252 or cp1250) or they will give an error.
Re-encoding can be turned off completely with argument encoding
= "bytes".