0
votes

I am writing a presentation in rmarkdown and compiling to pdf using 'Knit PDF' (Beamer). The code is as following

   ---
   title: "Title"
   author: "Author"
   date: 'Date'
   output:
   beamer_presentation:
   template: default.beamer
   ioslides_presentation: default
   themeoptions: compress
   widescreen: yes
   ---

   ```{r setup, include=FALSE}
   opts_chunk$set(cache=TRUE)
   ```    

  ## Slide 1
  A

  ## Slide 2
  B

But I get the following error

  Error in eval(expr, envir, enclos): object 'opts_chunk not found Calls: Anno
  <nymous> .... Execution halted

I have set the 'Weave Rnw files using' field to 'knitr'. Any ideas on how I might fix this error?

1

1 Answers

1
votes

Adding library(knitr) to the code chunk opts_chunk fixed it

{r setup, include=FALSE} library(knitr) opts_chunk$set(cache=TRUE)