hook_figasaur: 'knitr' hook to encode plot code into figures

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/hook_figasaur.R

Description

As plots are generated in a knitr document, encode the code used to produce them into the resulting PNG files. This can be done by setting the chunk option: figasaur = TRUE after setting knit_hooks$set(figasaur = hook_figasaur) at the top of your knitr document. The knitr_example.Rmd file included in this package shows a simple example.

Usage

1
hook_figasaur(before, options, envir)

Arguments

before, options, envir

Arguments as required by knitr; please see references for details

Details

Note that this only works for PNG files generated for HTML documents, though it does work when the PNGs are embedded in the HTML file (e.g. using the self_contained option in rmarkdown::render. See knitr::opts_hooks for more information.

Author(s)

David L Miller

References

https://yihui.name/knitr/hooks#chunk_hooks

See Also

encode

Examples

1
2
writeLines(readLines(
  system.file("knitr_example.Rmd", package = "stegasaur")))

richfitz/stegasaur documentation built on Feb. 12, 2021, 1:41 a.m.