Sweave
Introduction
Sweave is a system for mixing LaTeX and R (S) code to generate e.g.,
reports package documentation (vignettes).
It is now part of the standard R distribution (Package tools) and
maintained by Friedrich Leisch who also hosts its home page,
where the latest version of documentation and FAQ are available.
For Emacs users there is also an
extension sweave-site.el.
Overview
An extended example consists of the following files:
Directions
The template file is a standard LaTeX File with two special constructs
- Code blocks enclosed in
<<[label|options]
>>=
and @
- S expressions
\Sexpr{}
This file is processed with the Sweave("bike.Rnw")
from
the R prompt (assuming that the working directory is set to the
directory containing the named file). This will created a file
bike.tex
, that contains the LaTeX blocks as written in the
Rnw file
interspersed with the processed output from the R commands
This file is then run through the regular LaTeX process to created
either a (DVI,) PS, or PDF file.
Figures are created as EPS and PDF files, so both major output formats,
PS and PDF, are supported.
Some details may be found by studying the example files ...