Showing first {{hits.length}} results of {{hits_total}} for {{searchQueryText}}{{hits.length}} results for {{searchQueryText}}

We recommend the listings package for including R code in LaTeX documents. If you add

<p>to your preamble, you can then insert R code like this:</p>
fib <- function(n) {
  if (n < 2)
    fib(n - 1) + fib(n - 2)
fib(10) # => 55

This help article on using Knitr may also be of interest.

[edit] Overleaf guides

[edit] LaTeX Basics

[edit] Mathematics

[edit] Figures and tables

[edit] References and Citations

[edit] Languages

[edit] Document structure

[edit] Formatting

[edit] Fonts

[edit] Presentations

[edit] Commands

[edit] Field specific

[edit] Class files