This function reads the source code from a given named code chunk; i.e., {r chunk_name, echo = FALSE}.

decorate_chunk(chunk_name, eval = TRUE, echo = TRUE, include = TRUE, ...)

Arguments

chunk_name

The label name of the chunk we plan to add flair to.

eval

Evaluation options for chunk; behaves identically to ordinary knitr code chunk option eval

echo

Evaluation options for chunk; behaves identically to ordinary knitr code chunk option echo

include

Evaluation options for chunk; behaves identically to ordinary knitr code chunk option include

...

Any number of other chunk options to override.

Value

An object of class with_flair

Details

When run directly in a source file, decorate_chunk() reads the text of the active file and extracts the relevant string of source code from the chosen chunk. (Important: this only works in RStudio.)

When run during the knitr::knit() process, decorate_chunk() pulls the relevant chunk source during knitr::knit_hooks$set("source").