This exercise builds on the previous exercise where you learnt to build a simple MS Word report ⭐.
1 Objectives 🎯
- You are tasked with generating a simple analytically reproducible report on a fictitious outbreak;
- If you have generated the simple MS Word report as in Exercise 3, continue working on the same Quarto notebook you already modified. Otherwise, download the files
df1.RDataandexercise4.qmdusing the links provided on the right-hand side of this page. For simplicity, please put these two files under the same folder and open the Quarto notebook in RStudio. - Complete each of the following tasks and render the document after each task or set of tasks to track your progress;
- All text formatted in bold is a placeholder and should be replaced with appropriate automated calculations or cross-references;
- The final output should be a Microsoft (MS) Word report, containing all required tables, figures, corresponding captions and cross-references, and formatted with the Swiss TPH template.
3 Implement dynamic calculations
- See Quarto documentation about date formatting
- See Quarto documentation about dynamic dates
“The outbreak ran from date to date”
“Over the studied period, there were N cases, including N confirmed cases and N confirmed deaths.”
- See Quarto documentation about inline code
4 Reference tables
Table 1
“cross-reference provides a summary of the demographic characteristics and the outcome proportion for the overall population”
Table 2
“while cross-reference compares the demographic characteristics of individuals who died versus those who are still alive”
Table 3
“The results of the logistic regression model are summarized in the formatted regression table, which is presented in cross-reference.”
- There is a known issue with formatting
gtandgtsummarytables in MS Word, particularly when adding captions (thank you to Zhihan for raising this). This documented bug can cause rendering problems. To avoid this, please convert yourgtorgtsummarytables toflextablebefore generating the final document.
5 Reference figures
Figure 1
“cross-reference illustrates the outbreak’s progression, which can be divided into distinct phases.”
- See Quarto documentation about figure cross-references
- See
fig-widthandfig-heightoptions to adjust figure dimensions
6 Reference code chunks
7 Add bibliographic references
“citation describes trends in suspected and confirmed monkeypox virus cases in the Democratic Republic of Congo using epidemiological and laboratory surveillance data collected from 2010 to 2023.”
- You can generate the BibTeX entry from the DOI using citation management tools;
- See Quarto documentation about citations for guidance on formatting references;
- If you are not familiar with BibTeX files or programming, Quarto’s visual mode offers user-friendly tools for managing citations, allowing you to handle most of the previous steps automatically.
8 Format MS Word reports with styles
- See Quarto documentation about Word templates;
- To create a template with customized MS Word styles, you will need to start with a Quarto-rendered MS Word report. This is because not all MS Word styles are supported by Quarto, and starting from a rendered report ensures better compatibility.