Keep the report and its source together
HTML for this example
Select the code and use your copy shortcut. Changes in this preview are temporary.
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data:; base-uri 'none'; form-action 'none'"><title>Keep the report and its source together</title><style>
*{box-sizing:border-box}html{color-scheme:light}body{margin:0;color:#263238;background:#f0f3f5;font:16px/1.55 system-ui,-apple-system,"Segoe UI",sans-serif;--accent:#215967;--soft:#e4eff0}main{max-width:1000px;margin:auto;padding:26px}header{margin-bottom:20px}h1{font-size:clamp(25px,4.2vw,36px);line-height:1.15;letter-spacing:-.035em;margin:8px 0 10px}h2{font-size:21px;line-height:1.3;margin:0 0 12px}h3{font-size:17px;line-height:1.4;margin:0 0 7px}p{margin:8px 0 14px}.eyebrow{font-size:12px;text-transform:uppercase;font-weight:750;letter-spacing:.11em;color:var(--accent)}.fiction{font-size:12px;display:inline-block;padding:4px 8px;background:var(--soft);color:#364c53}.lede{max-width:760px;color:#465b64;margin-bottom:10px}.toolbar{display:flex;gap:12px;align-items:end;flex-wrap:wrap;margin:16px 0 20px;padding:14px;background:#fff;border:1px solid #bdcbd0}.toolbar label{flex:1 1 170px;font-size:13px;font-weight:650;min-width:0}.toolbar label input,.toolbar label select{display:block;width:100%;margin-top:5px}button,input,select,textarea{font:inherit;color:inherit}button,select,input{min-height:44px;border:1px solid #8a9ea7;border-radius:4px;background:#fff;padding:9px 12px;max-width:100%}button{cursor:pointer;font-weight:650}button:hover{background:var(--soft)}button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible,textarea:focus-visible{outline:3px solid #ad5700;outline-offset:3px}button[aria-pressed=true]{background:var(--accent);color:#fff}select,input,textarea{min-width:0}a{color:var(--accent)}.paper{background:#fff;border:1px solid #bdcbd0;padding:22px}.pair{display:grid;grid-template-columns:1fr 1fr;gap:20px}.pair>*{min-width:0}.metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:1px;background:#bdcbd0;border:1px solid #bdcbd0;margin:14px 0}.metrics>div{background:#fff;padding:16px}.metrics strong{font-size:30px;display:block;letter-spacing:-.04em;color:var(--accent)}.metrics span{display:block;font-size:13px;color:#47616b}.note{padding:15px 18px;background:var(--soft);border-left:4px solid var(--accent);margin:16px 0}.note p{margin:5px 0 0}.warn{background:#fff1d9;border-left-color:#a36300}.pill{display:inline-block;font-size:12px;padding:3px 8px;border:1px solid #a8bbc2;background:#f3f7f7;letter-spacing:0;font-weight:600}.pill.alert{background:#fff1d9;border-color:#cfa55f;color:#704900}.small{font-size:13px;color:#4c626c}.muted{color:#4c626c}.result{min-height:40px}details{border:1px solid #bac9cf;background:#fff;margin:10px 0}summary{padding:12px 16px;cursor:pointer;font-weight:650;min-height:44px}.detail{padding:0 16px 15px}details p:last-child{margin-bottom:0}table{width:100%;border-collapse:collapse;background:#fff;font-size:14px}caption{text-align:left;padding:10px 0;font-weight:650}th,td{padding:12px;text-align:left;vertical-align:top;border-bottom:1px solid #ced8dd;overflow-wrap:anywhere}th{background:var(--soft);font-size:12px}th[scope=row]{font-size:14px}.cell-label{display:none}.empty{padding:24px;background:#fff;border:1px dashed #8197a0}.rule{border-top:1px solid #bac9cf;padding-top:18px;margin-top:24px}footer{border-top:1px solid #bccbd2;margin-top:26px;padding-top:16px;font-size:12px;color:#4c626c}.record{padding:17px 0;border-top:1px solid #bdcbd0}.record:first-child{border-top:0}.record-top{display:flex;gap:10px;align-items:start;justify-content:space-between}.record p{margin:6px 0}.record .channel{font-size:19px;color:var(--accent);overflow-wrap:anywhere}.record .identity{font:12px ui-monospace,monospace}.ledger{background:#fff;border:1px solid #bdcbd0;padding:0 20px}.bar{height:12px;background:#dce5e8;overflow:hidden;margin:10px 0}.bar span{display:block;height:100%;background:var(--accent)}.status-line{font-weight:650;padding:10px 0;color:var(--accent)}[hidden]{display:none!important}svg{max-width:100%;height:auto}textarea{width:100%;min-height:320px;padding:16px;border:1px solid #8a9ea7;background:#172d3b;color:#eff7fc;font:13px/1.6 ui-monospace,Consolas,monospace;resize:vertical}pre{white-space:pre-wrap;overflow-wrap:anywhere;font:13px/1.6 ui-monospace,monospace;background:#17313e;color:#fff;padding:18px}.calendar{display:grid;grid-template-columns:repeat(5,1fr);gap:5px}.period{padding:9px 5px;border:1px solid #bbc9cd;background:#fff;font-size:12px}.period b{display:block}.period.lost{background:#e5e8ea;color:#53616a;text-decoration:line-through}.period.buffer{background:#fef0c8}.period.review{background:#e8e0f2}.period.project{background:#d9eaf4}.week{margin:16px 0}.week h3{font-size:14px}.receipt{max-width:550px;margin:auto;background:#fffefb;padding:27px;border:1px solid #c8bda7;border-top:5px solid #746242}.receipt h2{font:28px/1.2 Georgia,serif}.receipt .prototype{padding:12px;background:#f1e5c9;font-size:12px;font-weight:750}.receipt dl{display:grid;grid-template-columns:1fr 1fr;font-size:14px}.receipt dd{margin:0 0 8px}.receipt dt{color:#675b47}.receipt .amount{display:flex;justify-content:space-between;align-items:center;border-top:2px solid #6f624c;padding-top:14px;margin-top:16px}.receipt .amount strong{font-size:30px}.news{background:#fffcf5;border-top:4px solid #24241f;padding:22px;font-family:Georgia,serif}.masthead{font:clamp(24px,5vw,39px)/1.2 Georgia,serif;text-align:center;margin:0 0 12px}.issue{font:12px/1.5 system-ui;display:flex;justify-content:space-between;border-block:1px solid #353a35;padding:7px 0;gap:10px}.news-columns{display:grid;grid-template-columns:1.6fr 1fr;gap:24px;margin-top:20px}.news h2{font-size:30px;line-height:1.12}.news .lead{font-size:19px}.news aside{border-left:1px solid #c6bfae;padding-left:20px}.news figure{margin:18px 0 0}.news figcaption{font:12px/1.5 system-ui}.news .editor{font:14px/1.55 system-ui;margin-top:22px}.gradebook{background:#fff;padding:18px;border:1px solid #aabdc5}.grade-table{font-size:13px;table-layout:fixed}.grade-table th{font-weight:650}.grade-table td{height:66px;border:1px solid #aabdc5;text-align:center;font-size:20px}.grade-table th{border:1px solid #aabdc5}.grade-table .cell-label{font-size:12px}.grade-table th span{display:block;font-size:11px;font-weight:400}.grade-table.eight{font-size:11px}.grade-table.eight th{padding:8px}.grade-table .blank-name{width:17%}.grade-legend{display:flex;flex-wrap:wrap;gap:15px;border-block:1px solid #aabdc5;padding:10px 0;margin:15px 0;font-size:13px}.report{background:#fff;padding:24px;border-left:5px solid #396586}.report .stats{display:flex;gap:30px;padding:12px 0;border-bottom:1px solid #bbcbd4;flex-wrap:wrap}.report .stats strong{font-size:36px;color:#2d5774}.report .stats span{display:block;font-size:12px}.count-row{display:grid;grid-template-columns:90px 1fr 30px;gap:12px;align-items:center;margin:14px 0}.count-row .bar{margin:0;height:20px}.timeline-row{margin:18px 0}.timeline-track{position:relative;height:34px;background:repeating-linear-gradient(90deg,#dce5e9 0,#dce5e9 1px,transparent 1px,transparent 14.285%);border-block:1px solid #ccd6dc}.time-block{position:absolute;top:4px;height:24px;background:var(--accent);border-radius:2px}.time-block.conflict{background:#b76427}.timeline-label{display:flex;justify-content:space-between;gap:10px;font-size:13px;margin-bottom:5px}.scale{display:flex;justify-content:space-between;font-size:11px;color:#47616b}.notice-page{background:#faf7ef;--accent:#775617;--soft:#f4e8c7}.notice-page main{max-width:820px}.service-notice{background:#fffef9;padding:34px;border:1px solid #d9c99c;box-shadow:0 8px 0 #f1e8d5}.service-notice h2{font-size:32px;line-height:1.14;max-width:560px}.notice-icon{display:block;margin-bottom:15px}.update-strip{display:grid;grid-template-columns:1fr 1fr;gap:15px;margin:24px 0 0}.update-strip div{border-top:2px solid #c4a95c;padding-top:12px}.update-strip strong{display:block;font-size:23px;color:#684e1b}.delivery li{padding:7px 0}.receipt-page{background:#efece4;--accent:#6a5632;--soft:#e9e0ce}.newspaper-page{background:#eeeae1;--accent:#464836;--soft:#e6e7d9}.report-page{--accent:#305a7a;--soft:#e2ecf4}.pacing-page{--accent:#624579;--soft:#eae2f1}.training-page{--accent:#325d48;--soft:#e3ede7}.booking-page{--accent:#365f82;--soft:#e5edf5}.maintenance-page{--accent:#67523b;--soft:#eee8df}
@media(max-width:720px){main{padding:20px}.pair{gap:14px}.news-columns{gap:17px}.paper{padding:17px}.grade-table.eight th{font-size:10px;padding:5px}.grade-table.eight td{padding:5px}.calendar{gap:4px}.metrics strong{font-size:27px}}
@media(max-width:520px){main{padding:16px}.pair,.news-columns,.update-strip{grid-template-columns:1fr}.news aside{border-left:0;border-top:1px solid #c6bfae;padding:18px 0 0}.news{padding:18px}.news h2{font-size:28px}.issue{flex-wrap:wrap}.toolbar{padding:12px;gap:10px}.toolbar label{flex-basis:100%}.toolbar button{width:100%}.metrics{grid-template-columns:1fr 1fr}.metrics>div{padding:12px}.record-top{display:block}.record-top .pill{margin-top:6px}.calendar{grid-template-columns:repeat(5,minmax(0,1fr))}.period{padding:7px 3px;font-size:10px;overflow-wrap:anywhere}table thead{display:none}table,tbody,tr,td{display:block;width:100%}tr{border-bottom:1px solid #b8cad2;padding:10px 12px}td{border:0;padding:6px 0}.cell-label{display:block;font-size:11px;font-weight:750;color:#4c626c;margin-bottom:3px}.gradebook{padding:12px}.grade-table tr{padding:12px 0}.grade-table td{height:auto;border:0;border-bottom:1px solid #d2dce0;padding:12px;text-align:left;min-height:57px}.grade-table td:first-child{background:#edf2f5}.grade-table .blank-name{width:auto}.grade-table.eight td{padding:12px}.receipt{padding:20px}.receipt dl{grid-template-columns:1fr;gap:0}.receipt dd{margin-bottom:12px}.receipt .amount{gap:12px}.receipt .amount strong{font-size:27px}.report{padding:18px}.count-row{grid-template-columns:76px 1fr 25px;gap:8px}.timeline-label{display:block}.service-notice{padding:24px}.service-notice h2{font-size:28px}h1{font-size:27px}}
@media print{body{background:#fff}main{max-width:none;padding:0}.toolbar,footer{display:none}.grade-table,.grade-table tbody,.grade-table tr{display:table-row-group}.grade-table{display:table}.grade-table thead{display:table-header-group}.grade-table tr{display:table-row}.grade-table th,.grade-table td{display:table-cell;height:48px}.grade-table .cell-label{display:none}.paper,.gradebook{border:0}.note,details{break-inside:avoid}@page{size:letter landscape;margin:12mm}}
</style></head><body class="report-page"><main><header><span class="eyebrow">Workshop check-ins / computational report review</span><h1>Keep the report and its source together</h1><p class="lede">The supplied 8, 12 and 10 counts give expected total 30 and mean 10. These are manual expectations, not an executed R render.</p><span class="fiction">Original fictional example · local review copy</span></header><div class="toolbar" aria-label="Local reading controls"><label for="version">Read expected-result scenario<select id="version"><option value="original">Original: three sessions</option><option value="fourth">Proposed fourth session: count 6</option></select></label></div><section id="output" class="result" aria-label="Worked example"><article class="report"><span class="pill">Manually checked expected results · R not executed</span><h2>How many check-ins were recorded?</h2><div class="stats"><div><strong>30</strong><span>expected check-ins</span></div><div><strong>10</strong><span>expected mean per session</span></div><div><strong>3</strong><span>supplied sessions in this scenario</span></div></div><div class="count-row"><span>Session 1</span><div class="bar" aria-hidden="true"><span style="width:66.66666666666666%"></span></div><strong>8</strong></div><div class="count-row"><span>Session 2</span><div class="bar" aria-hidden="true"><span style="width:100%"></span></div><strong>12</strong></div><div class="count-row"><span>Session 3</span><div class="bar" aria-hidden="true"><span style="width:83.33333333333334%"></span></div><strong>10</strong></div><p>The supplied scenario contains 30 check-ins across 3 sessions, with an expected mean of 10 per session. Counts do not establish unique participants or an attendance rate.</p><aside class="note"><strong>One source for table and prose</strong><p>The native Rmd below derives the table, total, mean and inline prose from the same checkins object. Source validation rejects missing or negative counts.</p></aside></article><section class="rule"><h2>Open questions</h2><ul><li>How were check-ins recorded and checked?</li><li>Can one person appear in multiple session counts?</li><li>What denominator would an attendance-rate question require?</li></ul><p class="small">No R/package versions or successful render are claimed. Add integer-count and duplicate-session checks if required by the actual data policy.</p></section></section><section class="rule"><h2>Native checkins.Rmd source · original three sessions</h2><p class="small">Read-only original skeleton. The scenario switch above does not edit or execute this Rmd.</p><button type="button" id="selectSource">Select Rmd source</button><label for="source" class="small">Copy the selected source into your own report project</label><textarea id="source" readonly spellcheck="false">---
title: "Workshop check-in report — fictional example"
output:
html_document:
self_contained: true
---
# Question and source
How many check-ins were recorded across the supplied sessions?
Source: original fictional demonstration counts, not unique-person data.
```{r data}
checkins <- data.frame(
session = c("Session 1", "Session 2", "Session 3"),
count = c(8, 12, 10)
)
stopifnot(is.numeric(checkins$count), !anyNA(checkins$count),
all(checkins$count >= 0))
```
```{r summary}
total_checkins <- sum(checkins$count)
session_count <- nrow(checkins)
mean_checkins <- mean(checkins$count)
knitr::kable(checkins, caption = "Fictional session check-in counts")
```
# Interpretation
The supplied data contain `r total_checkins` check-ins across
`r session_count` sessions, with a mean of `r mean_checkins` per session.
These counts do not establish unique participants or an attendance rate.
# Open questions
- How were check-ins recorded and checked?
- Can one person appear in more than one session count?
- What denominator would an attendance-rate question require?
</textarea><p>Run in the actual R project: <code>rmarkdown::render("checkins.Rmd")</code>. Record actual versions and errors there. PDF/Word need their own settings and dependencies.</p></section><footer>Changes affect this local reading copy only and reset when reloaded. Actual records, decisions and approvals stay in the authorized original workflow. No data is sent or stored.</footer><noscript><p class="note">The worked example remains readable. Local view and filter controls require JavaScript.</p></noscript></main><script>const $=id=>document.getElementById(id); const esc=value => String(value).replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
function listen(id,event,fn){$(id).addEventListener(event,fn)}
function table(headers,rows){return '<table><thead><tr>'+headers.map(h=>'<th scope="col">'+esc(h)+'</th>').join('')+'</tr></thead><tbody>'+rows.map(row=>'<tr>'+row.map((c,i)=>'<td><span class="cell-label">'+esc(headers[i])+'</span>'+c+'</td>').join('')+'</tr>').join('')+'</tbody></table>'}
function metric(value,label){return '<div><strong>'+esc(value)+'</strong><span>'+esc(label)+'</span></div>'}
function note(title,body){return '<aside class="note"><strong>'+title+'</strong><p>'+body+'</p></aside>'}
function details(title,body){return '<details><summary>'+title+'</summary><div class="detail">'+body+'</div></details>'}
const originalCounts=[8,12,10];function counts(){return $('version').value==='fourth'?[...originalCounts,6]:originalCounts}
function stats(values){if(!values.length||values.some(v=>v===null||!Number.isFinite(v)||v<0))return null;return {total:values.reduce((s,v)=>s+v,0),mean:values.reduce((s,v)=>s+v,0)/values.length,n:values.length}}
function view(){let c=counts(),s=stats(c);return '<article class="report"><span class="pill">Manually checked expected results · R not executed</span><h2>How many check-ins were recorded?</h2><div class="stats"><div><strong>'+s.total+'</strong><span>expected check-ins</span></div><div><strong>'+s.mean+'</strong><span>expected mean per session</span></div><div><strong>'+s.n+'</strong><span>supplied sessions in this scenario</span></div></div>'+c.map((v,i)=>'<div class="count-row"><span>Session '+(i+1)+'</span><div class="bar" aria-hidden="true"><span style="width:'+(v/12*100)+'%"></span></div><strong>'+v+'</strong></div>').join('')+'<p>The supplied scenario contains '+s.total+' check-ins across '+s.n+' sessions, with an expected mean of '+s.mean+' per session. Counts do not establish unique participants or an attendance rate.</p>'+($('version').value==='fourth'?note('Change-and-re-render check','Add Session 4 and count 6 to the actual Rmd source, then re-render. A stale output still saying 30 and 10 would conflict with the expected 36 and 9. This local switch only compares expectations.'):note('One source for table and prose','The native Rmd below derives the table, total, mean and inline prose from the same checkins object. Source validation rejects missing or negative counts.'))+'</article><section class="rule"><h2>Open questions</h2><ul><li>How were check-ins recorded and checked?</li><li>Can one person appear in multiple session counts?</li><li>What denominator would an attendance-rate question require?</li></ul><p class="small">No R/package versions or successful render are claimed. Add integer-count and duplicate-session checks if required by the actual data policy.</p></section>'}
function update(){$('output').innerHTML=view()}listen('version','change',update);listen('selectSource','click',()=>{$('source').focus();$('source').select()});update();</script></body></html>