scplot: scplot

View source: R/reptools.r

scplotR Documentation

scplot

Description

Separate Chunk Plot

Usage

scplot(command, cap = NULL, scap = NULL, w = 5, h = 4, id = NULL)

Arguments

command

an command that causes a plot to be rendered

cap

long caption

scap

short caption

w

width of plot

h

height of plot

id

a string ID for the plot. Defaults to the current chunk label if knitr is running

Details

Runs a plot on its own Rmarkdown/Quarto knitr Chunk. The plot will have its own caption and size, and short captions are placed in the markdown TOC

Expressions cannot be re-used, i.e., each expression must evaluate to the right quantity after the chunk in which the scplot calls are made is finished, and the new constructed chunk is input. To input and run the constructed chunk: ⁠{r child='scplot.Rmd'}⁠ preceeded and following by 3 back ticks. Hmisc::putHcap is used to markup regular and short captions ⁠cap, scap⁠. Short caption appears in TOC. If no scap, then cap is used for this. To change the putHcap subsub argument set options(scplot.subsub='## ') for example.

Value

no value return; outputs R Markdown/Quarto markup

Author(s)

Frank Harrell

Examples

## Not run: 
scplot(id='chunkid')   # initialize output file scplot.Rmd
# or use scplot() to use the current chunk name as the id
# scplot(plotting expression, caption, optional short caption, w, h)
# scplot(plotting expression ...)

## End(Not run)

qreport documentation built on May 29, 2024, 3:51 a.m.