opts_chunk

0th

Percentile

Default and current chunk options

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

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():

[results=verbatim]{str(knitr::opts_chunk$get())} opts_chunk$get("prompt") opts_chunk$get("fig.keep") Usage: http://yihui.name/knitr/objects

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

format

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

Aliases
  • opts_chunk
  • opts_current
Documentation reproduced from package knitr, version 1.7, License: GPL

Community examples

Looks like there are no examples yet.