Skip to contents

Create an R Markdown code chunk.

Usage

chunk(
  ...,
  label = "",
  chunk_options = list(),
  text_above = "",
  text_below = ""
)

Arguments

...

R expressions from which to generate a chunk

label

chunk label

chunk_options

knitr chunk options

text_above

optional text to be placed above the code chunk

text_below

optional text to be placed below the code chunk

Examples

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.