opts_chunk {knitr}R Documentation

Default and current chunk options

Description

Options for R code chunks. When running R code, the object opts_chunk (default options) is not modified by chunk headers (local chunk options are merged with default options), whereas opts_current (current options) changes with different chunk headers and it always reflects the options for the current chunk.

Usage

opts_chunk

opts_current

Format

An object of class list of length 4.

Details

Normally we set up the global options once in the first code chunk in a document using opts_chunk$set(), so that all latter chunks will use these options. Note the global options set in one chunk will not affect the options in this chunk itself, and that is why we often need to set global options in a separate chunk.

Below is a list of default chunk options, retrieved via opts_chunk$get():

List of 53 $ eval : logi TRUE $ echo : logi TRUE $ results : chr "markup" $ tidy : logi FALSE $ tidy.opts : NULL $ collapse : logi FALSE $ prompt : logi FALSE $ comment : chr "##" $ highlight : logi TRUE $ strip.white : logi TRUE $ size : chr "normalsize" $ background : chr "#F7F7F7" $ cache : logi FALSE $ cache.path : chr "cache/" $ cache.vars : NULL $ cache.lazy : logi TRUE $ dependson : NULL $ autodep : logi FALSE $ cache.rebuild: logi FALSE $ fig.keep : chr "high" $ fig.show : chr "asis" $ fig.align : chr "default" $ fig.path : chr "figure/" $ dev : NULL $ dev.args : NULL $ dpi : num 72 $ fig.ext : NULL $ fig.width : num 7 $ fig.height : num 7 $ fig.env : chr "figure" $ fig.cap : NULL $ fig.scap : NULL $ fig.lp : chr "fig:" $ fig.subcap : NULL $ fig.pos : chr "" $ out.width : NULL $ out.height : NULL $ out.extra : NULL $ fig.retina : num 1 $ external : logi TRUE $ sanitize : logi FALSE $ interval : num 1 $ aniopts : chr "controls,loop" $ warning : logi TRUE $ error : logi TRUE $ message : logi TRUE $ render : NULL $ ref.label : NULL $ child : NULL $ engine : chr "R" $ split : logi FALSE $ include : logi TRUE $ purl : logi TRUE

Note

opts_current is read-only in the sense that it does nothing if you call opts_current$set(); you can only query the options via opts_current$get().

References

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

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

Examples

opts_chunk$get("prompt")
opts_chunk$get("fig.keep")

[Package knitr version 1.15.20 Index]