Appendix D — Colophon

This page records how the book was produced: the software environment, the visual theme, the licence, and the citation details. The version record below is the first thing to check when code from the book produces a different answer on your machine from the one printed in the text.

D.1 What produced this page

The block below ran while this page was being built, so the versions in it are the ones that produced everything you have read.

sessioninfo::session_info(pkgs = "attached")
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.4.2 (2024-10-31)
#>  os       macOS 26.5.2
#>  system   aarch64, darwin20
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Asia/Singapore
#>  date     2026-07-29
#>  pandoc   3.10.1 @ /opt/homebrew/bin/ (via rmarkdown)
#>  quarto   1.6.42 @ /Users/smishra/Applications/quarto/bin/quarto
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  ! package   * version date (UTC) lib source
#>  P dplyr     * 1.2.1   2026-04-03 [?] CRAN (R 4.4.2)
#>  P forcats   * 1.0.1   2025-09-25 [?] CRAN (R 4.4.1)
#>  P ggplot2   * 4.0.3   2026-04-22 [?] CRAN (R 4.4.2)
#>  P here      * 1.0.2   2025-09-15 [?] CRAN (R 4.4.1)
#>  P lubridate * 1.9.5   2026-02-04 [?] CRAN (R 4.4.3)
#>  P patchwork * 1.3.2   2025-08-25 [?] CRAN (R 4.4.1)
#>  P purrr     * 1.2.2   2026-04-10 [?] CRAN (R 4.4.2)
#>  P readr     * 2.2.0   2026-02-19 [?] CRAN (R 4.4.3)
#>  P scales    * 1.4.0   2025-04-24 [?] CRAN (R 4.4.1)
#>  P stringr   * 1.6.0   2025-11-04 [?] CRAN (R 4.4.1)
#>    tibble    * 3.3.1   2026-01-11 [1] CRAN (R 4.4.3)
#>  P tidyr     * 1.3.2   2025-12-19 [?] CRAN (R 4.4.3)
#>  P tidyverse * 2.0.0   2023-02-22 [?] CRAN (R 4.4.0)
#> 
#>  [1] /Users/smishra/Documents/GitHub/r-intro/renv/library/macos/R-4.4/aarch64-apple-darwin20
#>  [2] /Users/smishra/Library/Caches/org.R-project.R/R/renv/sandbox/macos/R-4.4/aarch64-apple-darwin20/f7156815
#> 
#>  * ── Packages attached to the search path.
#>  P ── Loaded and on-disk path mismatch.
#> 
#> ──────────────────────────────────────────────────────────────────────────────

Those are the packages the book attaches directly. The full set, including everything they depend on, is recorded in renv.lock, currently 109 packages deep. Appendix C explains how the lockfile works and how to install exactly those versions on your own machine.

To print the same thing for yourself, run sessioninfo::session_info() in your console. If sessioninfo is not installed, sessionInfo() with a capital I is in base R and does a rougher version of the same job.

D.2 How it looks

The site theme is bootswatch litera with a layer of project SCSS on top. litera was picked because it is one of the few bundled themes that does not fetch a web font from Google’s servers, so the book renders identically offline and on a network that blocks Google. Appendix C says more about why that mattered.

Figures use a five-colour palette, defined in R/nus_theme.R and applied through theme_set() so no chapter has to remember it:

nus_colours
#>      blue   crimson      teal    orange      grey       ink     muted      rule 
#> "#003D7C" "#96233F" "#007E96" "#E8720C" "#BFC6CE" "#1F2933" "#5A6672" "#DDE3EA"

The first five are the series colours. ink, muted and rule are for text and gridlines.

The palette was tested in code. scripts/check_palette.R simulates protanopia, deuteranopia and tritanopia (Machado et al. 2009, full severity) and scores every pair by CIEDE2000, where the worst case is dE00 18.9, between blue and teal under deuteranopia. It checks that adjacent colours sit at least 8 L* apart, so the series survive a photocopy. And it checks thin-line contrast against white under WCAG 1.4.11: the first four clear the 3:1 threshold at 10.7, 8.1, 4.8 and 3.1, while the fifth manages 1.7 and is restricted to filled areas, never lines or points.

The palette is limited to five series colours. nus_pal() raises an error rather than recycle a sixth colour, since two series drawn in the same colour cannot be told apart in the finished figure.

Figures are SVG rather than PNG, so plot text stays sharp at any zoom.

D.3 Licence

The text, the code and the figures are MIT licensed. Copyright 2026 Swapnil Mishra. The full text is in LICENSE in the repository. In practice, you may use, adapt and redistribute the material, including for teaching. Attribution is appreciated but not required.

The logos in assets/logos/ are excluded. They are the trade marks of the National University of Singapore, the Saw Swee Hock School of Public Health, the Centre for Epidemic Research and Modelling and the Machine Learning and Global Health Network, and a licence on my writing has no authority over somebody else’s mark. If you fork the book, take them out.

The data is a third exception. An MIT licence on this repository cannot relicense numbers I did not produce. The cases and deaths, the government-response indices and the mobility series come from three separate third parties, each with its own terms of use. Appendix B names all three and points at their documentation, and that documentation is what governs reuse, not this page.

D.4 Citing it

If a citation is expected of you:

Mishra, S. (2026). An Introduction to R: working with epidemiological data, using Singapore’s 2020 COVID-19 record. Saw Swee Hock School of Public Health, National University of Singapore. https://cerm-nus.github.io/r-intro/

@book{mishra2026rintro,
  author    = {Mishra, Swapnil},
  title     = {An Introduction to {R}: Working with Epidemiological Data,
               Using {Singapore}'s 2020 {COVID-19} Record},
  year      = {2026},
  publisher = {Saw Swee Hock School of Public Health,
               National University of Singapore},
  address   = {Singapore},
  url       = {https://cerm-nus.github.io/r-intro/}
}

This is a living document and the date in the page header is the date of the last render, so include an access date if the version you read matters. If it matters a lot, cite the commit: every page has a “View source” link in the right margin that takes you to the exact revision.

For the data, cite the three original sources rather than this book. Appendix B has them formatted.

D.5 Telling me something is wrong

Reports of errors are welcome. An error in a textbook propagates into every assignment written from it, which makes it worth more attention than an error in most other places.

The fastest route is the “Report an issue” link in the right-hand margin of the page you are on. It opens a GitHub issue with the page already identified. If you can see the fix, “Edit this page” opens the source file directly and turns your correction into a pull request.

A report that lets me reproduce the problem contains four things: which page and section, the code you ran, the complete error or warning text pasted rather than described, and the output of sessioninfo::session_info(). The third is the one most often trimmed, and it carries most of the information: “It said something about an object not found” and “Error: object ‘daily_cases’ not found” are different amounts of information.

Reports that a passage is confusing are as welcome as reports that a number is wrong. If you read something several times and still had to guess at its meaning, the passage most likely needs rewriting, and that is useful to know.

D.6 Acknowledgements

Written by Swapnil Mishra, working with Claude Code (Anthropic, Opus 5 model), which helped draft the text, convert the original base-R worksheet to the tidyverse, and check the numbers against the data. A later revision — the reorganisation of the sources into chapters/ and appendices/, the restructuring of the good-practice material into the chapters and a consolidated page, and the language passes across every chapter — was made with Kimi Code (Moonshot AI, K3 model). Responsibility for the final content rests with the author.