Skip to content

Typeset Code Chunks

cpfaff edited this page May 20, 2013 · 1 revision

R code chunks

R code chunks have their own environment (Noweb) which gets detected on the Knitr run. The code inside the chunks is then validated via R. The box below shows an example code chunk. In the header a name and options which influence the handling of the chunk content and the output to the LaTeX document can be set.

<<name, options>>=
Your R code here!
@

Several Knitr options are already set globally for the Open-Science-Paper. These options you can find in usr/subdocuments/options/osp_global_knitr_options.Rnw file. You can simply overwrite an option locally for a single code chunk by setting it to another value in the chunk header. To change it globally change the options in the global options file. For an overview about other Knitr options I would recommend to read the package documentation or to visit the authors homepage.

Clone this wiki locally