Skip to contents

Programmatic R Markdown Code Chunk Generation

The goal of chunky is to enable quick and simple programmatic generation of R Markdown code chunks.

Installation

Install the chunky package from GitHub with:

# install.packages("devtools")
devtools::install_github("jasenfinch/chunky")

Example

library(chunky)

chunk(a <- 1,
      b <- 2,
      a + b,
      label = 'example',
      chunk_options = list(eval = FALSE),
      text_above = 'Some example text above.',
      text_below = 'Some example text below.') 
#> Some example text above.
#> 
#> ```{r example, eval=FALSE}
#> a <- 1
#> b <- 2
#> a + b
#> ```
#> 
#> Some example text below.