opts_knit {knitr} | R Documentation |
Options including whether to use a progress bar when knitting a document, and the base directory of images, etc.
opts_knit
An object of class list
of length 4.
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.package.foo
in options()
will be set as an option foo
in opts_knit
,
i.e. global options in base R with the prefix knitr.package.
correspond to options in opts_knit
. This can be useful to set package
options in ‘~/.Rprofile’ without loading knitr.
Below is a list of default package options, retrieved via
opts_knit$get()
:
List of 24
$ progress : logi TRUE
$ verbose : logi FALSE
$ width : int 75
$ eval.after : chr "fig.cap"
$ base.dir : NULL
$ base.url : NULL
$ root.dir : NULL
$ child.path : chr ""
$ upload.fun :function (x)
$ animation.fun :function (x, options)
$ global.device : logi FALSE
$ global.par : logi FALSE
$ concordance : logi FALSE
$ documentation : int 1
$ self.contained : logi TRUE
$ unnamed.chunk.label: chr "unnamed-chunk"
$ highr.opts : NULL
$ out.format : NULL
$ child : logi FALSE
$ parent : logi FALSE
$ tangle : logi FALSE
$ aliases : NULL
$ header : Named chr [1:3] "" "" ""
..- attr(*, "names")= chr [1:3] "highlight" "tikz" "framed"
$ global.pars : NULL
Usage: https://yihui.name/knitr/objects/
A list of available options: https://yihui.name/knitr/options/#package_options
opts_knit$get("verbose") opts_knit$set(verbose = TRUE) # change it if (interactive()) { # for unnamed chunks, use 'fig' as the figure prefix opts_knit$set(unnamed.chunk.label = "fig") knit("001-minimal.Rmd") # from https://github.com/yihui/knitr-examples }