Homework 05 — Write Your Analysis as a Report
Turn a real analysis into a reproducible, professional Word document with Quarto
Take a completed analysis and write it up as a reproducible Quarto report that renders to Word, using YAML front matter, named code chunks, and inline code (week 3 Quarto lecture/worksheet 05).
Overview
In Lecture 05 and Worksheet 05 you learned Quarto — how one .qmd file holds your writing and your code, computes every number and figure, and renders to a professional Word document. No more copying results by hand.
This homework asks you to prove you can do it on your own analysis. You will take a complete analysis you have already run and rewrite it as a Quarto report that renders to Word.
Choose ONE analysis to write up:
- your Cisco t-test from Homework 03, or
- the paper calibration regression from Worksheet 05 (Regression).
Submit to Canvas: (1) your
.qmdsource file and (2) the rendered.docxWord document.
Start from a template. Open leaf_report_template.qmd from the Quarto worksheet (or regression_analysis_report.qmd) and adapt it — you do not have to start from a blank file.
Part 1 · Set up the document (→ see Lecture 05)
Create a new .qmd file and write YAML front matter that makes a professional Word document — a title, a table of contents, and numbered sections.
---
title: "..."
author: "Your Name"
date: today
format:
docx:
toc: true
number-sections: true
fig-width: 6
fig-height: 4
---Q1 — Paste your YAML front matter here:
Q2 — Which analysis did you choose (Cisco t-test / paper regression)? ________
Part 2 · Bring in the analysis with named chunks (→ see Lecture 05, Worksheet 05)
Move your analysis into the report as code chunks. Follow the same habits as your scripts:
- one library chunk at the top
- a separate load-data chunk
- small chunks, each with a unique label
Q3 — How many code chunks does your report have? ________
Q4 — List the label you gave your data-loading chunk: ________
⚠️ Watch out! Quarto renders top to bottom in a fresh session. Load your libraries and data in chunks above anything that uses them, or the render will fail and name the broken chunk.
Part 3 · Put live numbers in your sentences (→ see Lecture 05)
Use inline code (`r ... `) so at least two numbers in your writing are computed, not typed. For example, a mean, a p-value, a slope, or an R².
Q5 — Write out the two sentences that use inline code (show the
`r `you used):
Q6 — Why is an inline-code number safer than one you type by hand?
Part 4 · Add a table and a figure (→ see Worksheet 05)
Your report must include one summary table and one figure, both generated by code (not pasted images).
Q7 — What does your table show? ________________
Q8 — What does your figure show, and what is its figure caption? ________________
To hide the code and show only results in the final report, set echo: false in the execute: block at the top of the file. A reader wants the findings, not the R.
Part 5 · Write it up (→ see Lecture 04 / Worksheet 05 reporting formats)
Add short Introduction, Results, and Discussion sections in Markdown prose. Your Results section should contain a proper results sentence (t-test) or results paragraph (regression), following the format from the relevant lecture.
Q9 — Paste your Results sentence/paragraph here:
Part 6 · Render to Word (→ see Lecture 05)
Press Render (Ctrl/Cmd + Shift + K) and open the .docx.
Q10 — Did it render to Word without errors on the first try? Y / N
Q11 — If not, which named chunk failed, and how did you fix it?
Submission checklist
Before uploading to Canvas, confirm:
Going further (optional — no points)
Add two more output formats to your YAML and re-render — one file, three documents:
format:
docx: default
html: default
pptx: defaultWhich format would you actually hand in, and which would you post online? ________
Reproducibility is the whole point: anyone — including future-you — can open your .qmd, press Render, and regenerate your exact results.