Learn R Programming

qreport (version 1.0-1)

makecodechunk: makecodechunk

Description

Create Text for Running Code Chunk

Usage

makecodechunk(
  cmd,
  opts = NULL,
  results = "asis",
  lang = "r",
  callout = NULL,
  h = NULL,
  w = NULL
)

Value

character vector

Arguments

cmd

character string vector of commands to run inside chunk

opts

optional list of chunk options, e.g. list(fig.width=6, fig.cap="This is a caption"). See https://yihui.org/knitr/options/ for a complete list of options.

results

format of results, default is 'asis'. May specify results='markup'.

lang

language for the chunk

callout

an optional Quarto callout to include after #| after the chunk header that affects how the result appears, e.g. callout='column: margin'

h

optional height to place after the chunk header after #|

w

optional width

Author

Frank Harrell

Details

Creates text strings suitable for running through knitr. The chunk is given a random name because certain operations are not allowed by knitr without it.

Examples

Run this code
makecodechunk('x <- pi; print(x)')

Run the code above in your browser using DataLab