Unlike sframe_demo_qmd(), which only works for one of the bundled demo
instruments (it looks name up in sframe_demos()), this writes a
runnable Quarto notebook for any instrument, using its own responses. It
exposes the complete ordered plan, screening, run status, detailed results,
plots and reports. The notebook reads the instrument and its responses back from 2 companion
files written alongside it, so all 3 files must stay together.
Arguments
- instrument
An
sframeobject.- data
A
data.frameof responses, read byread_responses()when the notebook runs.- dir
Directory to write into. Defaults to the working directory.
- basename
Character or
NULL. File base name shared by the.qmd,.sframe, and_responses.csvfiles. Defaults to a slug of the instrument's title.- overwrite
Logical. Overwrite existing files of the same name.
Examples
item <- sf_item("q1", "How satisfied are you?", type = "text")
instr <- sf_instrument("Demo", components = list(item))
resp <- data.frame(q1 = c("Great", "Fine"))
out <- sframe_analysis_qmd(instr, resp, dir = tempdir())
#> Notebook written to: /tmp/Rtmp44tQ8U/Demo.qmd
#> Instrument and responses written alongside it: Demo.sframe, Demo_responses.csv
#> Keep all 3 files together, then open and render the notebook.
basename(out$qmd)
#> [1] "Demo.qmd"