knitr (version 1.5)

opts_knit: Options for the knitr package

Description

Options including whether to use a progress bar when knitting a document, and the base directory of images, etc.

Usage

opts_knit

Arguments

format

List of 4 $ get :function (name, default = FALSE, drop = TRUE) $ set :function (...) $ merge :function (values) $ restore:function (target = value)

Details

Besides the standard usage (opts_knit$set()), we can also set package options prior to loading knitr or calling knit() using options() in base R. A global option knitr.foo in options() will be set as an option foo in opts_knit, i.e. global options in base R with the prefix knitr. correspond to options in opts_knit. This can be useful to set package options in ~/.Rprofile without loading knitr.

References

Usage: http://yihui.name/knitr/objects

A list of available options: http://yihui.name/knitr/options#package_options

Examples

Run this code
opts_knit$get("verbose")
opts_knit$set(verbose = TRUE)  # change it
# for unnamed chunks, use 'fig' as the figure prefix
options(knitr.unnamed.chunk.label = "fig")
knit("001-minimal.Rmd")  # from https://github.com/yihui/knitr-examples

Run the code above in your browser using DataCamp Workspace