There was a slight mistake in this presentation made with beamer and Rnw file. The code chunk options were not quoted properly. I corrected this in the code below and now it works.
\documentclass{beamer}
% Inspiration from
% http://www.r-bloggers.com/r-and-presentations-a-basic-example-of-knitr-and-beamer/
\begin{document}
\title{A Minimal Demo of knitr}
\author{Yihui Xie}
\maketitle
\begin{frame}[fragile]
You can test if \textbf{knitr} works with this minimal demo. OK, let's
get started with some boring random numbers:
<
set.seed(1121)
(x=rnorm(20))
mean(x);var(x)
@
\end{frame}
\begin{frame}[fragile]
The first element of \texttt{x} is \Sexpr{x[1]}. Boring boxplots
and histograms recorded by the PDF device:
<
## two plots side by side (option fig.show=hold)
boxplot(x)
hist(x,main='')
@
\end{frame}
\begin{frame}[fragile]
Plots
<
## two plots side by side (option fig.show=hold)
boxplot(x)
hist(x,main='')
@
\end{frame}
\end{document}
No comments:
Post a Comment