
Deterministically compile a validated spec_ir into a Quarto report (.qmd)
Source: R/compile-quarto.R
compile_quarto_report.RdGenerates a clean, self-contained Quarto markdown document combining a
structured study overview, LaTeX mathematical model specification, an
auditable table of inferred defaults and rationales, the validated YAML IR,
and the deterministic AST-verified simulation script produced by
compile_r_script(). All free-text metadata, prompts, and rationales are
strictly sanitized against Quarto frontmatter breakouts, inline knitr code
execution, markdown code-fence escapes, HTML/XSS tags, and dangerous LaTeX
macros.
Arguments
- spec
A validated
spec_irobject.- file
Optional file path; when provided, writes the
.qmdreport tofileand returns the document text invisibly.- format
Quarto output format (e.g.,
"html","pdf","docx").- execute
Logical; whether Quarto code chunks should execute on render (
eval: truevseval: false). Defaults toTRUE.
Examples
spec <- new_spec_ir(
design_type = "power_analysis",
hierarchy = list(levels = 2L, n_clusters = 40L, cluster_size = 20L, icc = 0.2),
simulation = list(n_reps = 50L, seed = 2026L)
)
qmd <- compile_quarto_report(spec)
cat(substr(qmd, 1, 500))
#> ---
#> title: "Untitled Statistical Study"
#> subtitle: "Reproducible Statistical Simulation Report (specshiny IR v1.2.0)"
#> format: html
#> execute:
#> echo: true
#> warning: false
#> message: false
#> eval: true
#> ---
#>
#> ## 1. Study Design Overview
#>
#>
#> | Component | Specification |
#> | :--- | :--- |
#> | **Design Type** | `power_analysis` |
#> | **Data Hierarchy** | 2-level (40 clusters x 20 observations; total N = 800; ICC = 0.2) |
#> | **Outcome** | `y` (`gaussian`, `identity` link) |
#> | **Focal Term** | `x1` (true effect =