I\'m trying to make a presentation on ggplot2 graphics using beamer + sweave. Some slides should have two columns; the left one for the code, the right one for the resulting gra
keep.source=TRUE
in SweaveOpts. For more fancy control, see fancyvrb
and FAQ #9 of Sweave manual.\setkeys{Gin}{width=1.0\textwidth}
here is a slight modification:
... snip ...
\SweaveOpts{pdf=TRUE, echo=FALSE, fig=FALSE, eps=FALSE, tidy=T, width=4, height=4, keep.source=TRUE}
\title{Reproducible data analysis with \texttt{ggplot2} \& \texttt{R}}
... snip ...
\begin{document}
\setkeys{Gin}{width=1.1\textwidth}
... snip...
<<echo=TRUE,fig=FALSE>>=
library(ggplot2)
p <-
qplot(mpg,
wt,
data=mtcars,
colour=cyl) +
theme_grey(base_family=
"Helvetica")
@