Write R chunk to template
add_chunk(
x,
echo = "false",
warnings = "false",
eval = "true",
label = NULL,
add_option = FALSE,
chunk_op = NULL
)
Content to be written within the R chunk. Wrap in quotation marks ("").
TRUE/FALSE; Option to repeat code in the document. Default is false.
TRUE/FALSE; Option to report warnings in the console during render. Default is false.
TRUE/FALSE; Option to evaluate the chunk. Default is true.
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)
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#| warning: false \n#| eval: true \nplot(cars$speed, cars$distance)\n``` \n"