Write R chunk to template
add_chunk(
x,
label = NULL,
add_option = TRUE,
chunk_option = c("echo: false", "warnings: false", "eval: true"),
rmark_option = NULL
)Content to be written within the R chunk. Wrap in quotation marks ("").
The name of the chunk in the 'label:' section of the R code chunk. This should be in snakecase (i.e., in which words are written in lowercase and connected by underscores).
TRUE/FALSE; Option to add additional chunk options. Default is false.
List of chunk options to add. For example: c("output: true", "error: false)
List of chunk options to add after indicating the language of the chunk as used in Rmarkdown.
Write an additional R chunk into the template using this function. The code can be written as usual, just remember to put it entirely in quotes for the function to render it properly
add_chunk("plot(cars$speed, cars$distance)")
#> [1] "```{r} \n#| echo: false \n#| warnings: false \n#| eval: true\nplot(cars$speed, cars$distance)\n``` \n"