# What's wrong with this Sweave Document

Every time I run the code below, it runs without error. It is only when I try to sweave the output in the last frame requested does it fail. What's more confusing to a LaTeX/Sweaving newbie like myself is that I paste the xtable(....) function into another R session, it produces LaTeX output to my output window. I even pasted the generated LaTeX output back into my document as a new slide and it worked swimmingly.

\documentclass{beamer}
\usepackage[OT1]{fontenc}
%\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry} %set the margins
\usepackage{Sweave}

% before compiling, need to change working directory in open version of R

<<echo=FALSE, eval=TRUE>>=
library(xtable)
Aye <- sample(c("Yes", "Si", "Oui"), 177, replace = TRUE)
Bee <- sample(c("Hum", "Buzz"), 177, replace = TRUE)
Sea <- sample(c("White", "Black", "Red", "Dead"), 177, replace = TRUE)
@

\begin{document}

\begin{frame}
\frametitle{First Slide}
Contents of the first slide
\end{frame}

\begin{frame}
\frametitle{Second Slide}
<<>>=
@

\end{frame}

\end{document}

-

Change the <<>>= to <<echo=false, results=tex>> if you want to include the table in the frame.