makecallout {qreport}R Documentation

makecallout

Description

General Case Handling of Quarto Callouts

Usage

makecallout(...)

Arguments

...

can be any of the following

  • x object to print (if type='print'), or one or more formulas whose right hand sides are to be run. Left side provides labels if needed by the particular callout, and if raw is included on the right side any R code chunk run will have results='asis' in the chunk header.

  • callout character string giving the Quarto callout

  • label character string label if needed and if not obtained from the left side of a formula

  • type defaults to 'print' to print an object. Set to 'run' to run a chunk or 'cat' to use cat() to render.

  • now set to FALSE to return code instead of running it

  • results if not using formulas, specifies the formatting option to code in the code header, either 'asis' (the default) or 'markup'

  • close specifies whether to close the callout or to leave it open for future calls

  • parameters passed to print

Details

This function generates and optionally runs markdown/R code that runs Quarto callouts such as collapsible notes or marginal notes. Before rendering x, options(rawmarkup=TRUE) is set so that Hmisc::rendHTML will not try to protect html in things like margins. Quarto doesn't like the surrounding html protection lines in that context. The option is set back to its original value after rendering.

Value

if code is not executed, returns a character vector with the code to run

Author(s)

Frank Harrell

Examples

x <- 1:3
co <- '.callout-note collapse="true'
makecallout(x, callout=co, label='# thislabel', type='print')
makecallout(thislabel ~ x, callout=co, type='print')

[Package qreport version 1.0-1 Index]