
Record a GIF demo of an R expression
record_demo.RdCaptures the unevaluated R expression expr, types it line-by-line into
a freshly-spawned R session inside a vhs recording, and writes the
result to output. The R front-end is chosen by backend (see below).
Setup is a one-liner: if the required binaries are missing, the
function points to vhsr_install().
Usage
record_demo(
expr,
output = "demo.gif",
...,
backend = c("auto", "arf", "radian", "R"),
tape = NULL,
quiet = FALSE
)Arguments
- expr
An R expression (typically a
{ ... }block). Captured unevaluated; lines are typed verbatim into the REPL.- output
Path to the output file. The extension determines the format (
.gif,.mp4,.webm).- ...
Pacing and styling arguments forwarded to
tape_options(). Pass any ofwidth,height,font_size,theme,typing_speed,playback_speed,line_pause,start_pause,end_pause,paragraph_pause,typing_speed_jitterby name. Unknown names error.- backend
Which interactive R front-end to record.
"auto"(the default) prefers"arf"(a Rust-based modern R console with tree-sitter syntax highlighting and zero runtime dependencies — see https://github.com/eitsupi/arf), falls back to"radian"if found, otherwise plain"R".- tape
Optional. A raw
.tapescript as a string (or path to a.tapefile). When supplied,exprand the styling args are ignored and the tape is run verbatim.- quiet
If
TRUE, suppress vhs stdout/stderr.
See also
tape_options() for the full pacing/styling argument list.