Usage with R Markdown documents
Embed a sketch R file in an R Markdown document#
Suppose the sketch R file is sketch.R, then it can be embedded in an
RMD file using sketch::insert_sketch in a code chunk. This is
particularly useful when you have a large application.
Use the sketch knitr engine#
sketch now has a knitr engine! To use it,
- include
knitr::knit_engines$set(sketch = sketch::eng_sketch)in the setup code chunk, and then - use
```{sketch}```in place of```{r}```.
Concretely, the code chunks
will produce
The engine supports the following options:
rules,deparsersto pass on tosource_r,debug,asset_tagsto pass on tocompile_r, andstylefor styling the iframe, e.g.,style = "width: 100%; border: none;"is a common option to use.