\documentclass[letter]{article}
\begin{document}
In this example we embed parts of the examples from the
\texttt{kruskal.test} help page into a \LaTeX{} document :
<<>>=
data(airquality)
kruskal.test(Ozone ~ Month, data = airquality)
@
\end{document}

This issue just bites users again and again. It is one tiny reason motivating the knitr package: if you like pgfSweave, you probably can experiment with library(knitr); knit('your_input.Rnw') too.
–
YihuiFeb 13 '12 at 19:34