Learn R Programming

knitr (version 0.6.3)

run_chunk: Run the code in a specified chunk

Description

We can specify a chunk label and use this function to evaluate the code in this chunk. It is an alternative to the chunk reference in Sweave.

Usage

run_chunk(label, envir = parent.frame())

Arguments

label
the chunk label
envir
the environment in which to evaluate the code

Value

  • Values returned by the code in the chunk.

Details

The difference between this type of chunk reference and the chunk option ref.label is that the latter can only be used for a chunk so that it has exactly the same code as the reference chunk, whereas this function makes it possible to collect several little chunks and run them inside another big chunk.

Examples

Run this code
# see http://yihui.name/knitr/demo/reference/

Run the code above in your browser using DataLab