decorate_chunk: Builds a 'decorated' object from a code chunk

View source: R/decorate_chunk.R

decorate_chunkR Documentation

Builds a decorated object from a code chunk

Description

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

Usage

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.

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").

Value

An object of class decorated


kbodwin/flair documentation built on Feb. 6, 2023, 4:24 p.m.