0

How do I get the R code below to print on separate lines? It seems like this should be fairly simple.

\documentclass{beamer}

\begin{document}

\frame{
<<eval=FALSE, message=FALSE, warning=FALSE, tidy=FALSE,error=FALSE,    echo=TRUE, results='asis'>>=
install.packages('reshape2')
install.packages('car')
install.packages('pastecs')  
@ 
}


\end{document}
spindoctor
  • 1,719
  • 1
  • 18
  • 42
  • 1
    deleting the `\frame{}` seems to work. – Gregor Thomas Feb 09 '16 at 23:58
  • Doesn't really matter, but when `eval = FALSE` most of your other options are irrelevant (`message`, `warning`, `error`, and `results` will only apply to evaluated code). – Gregor Thomas Feb 10 '16 at 00:00
  • OK, I see that, but I want to include these commands as part of a beamer slide...so don't I need to put them in a frame somehow? – spindoctor Feb 10 '16 at 00:10
  • 1
    Looking at [Yihui's examples](https://gist.github.com/yihui/1803930), he seems to always use fragile frames. If you do `\begin{frame}[fragile] ... \end{frame}` it seems to work. If you're not a LaTeX expert you may prefer authoring in Rmarkdown - you can still [compile to Beamer](http://rmarkdown.rstudio.com/beamer_presentation_format.html). – Gregor Thomas Feb 10 '16 at 00:20
  • Using `install.packages` in a `knitr` document is a bad idea, see the comments [here](http://stackoverflow.com/questions/35186983/cannot-compile-rmarkdown-document/35187295) and the suggested duplicate. – CL. Feb 10 '16 at 15:05
  • @CL. it has `eval = FALSE` here, so no matter. – Gregor Thomas Feb 10 '16 at 22:19

0 Answers0