Learn R Programming

qreport (version 1.0-1)

scplot: scplot

Description

Separate Chunk Plot

Usage

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

Value

no value return; outputs R Markdown/Quarto markup

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

Author

Frank Harrell

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.

Examples

Run this code
if (FALSE) {
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 ...)
}

Run the code above in your browser using DataLab