This website has been created to accompany the 2020 open access electronic edition of London Lives: Poverty, Crime and the Making of a Modern City, 1690-1800 by Tim Hitchcock and Robert Shoemaker. Its main purpose is to document the code and methods used to create visualisations for the book using R and R Markdown. In addition, I outline the process of building a website for the book.

I’m posting the code in the spirit of openness that has motivated the book’s authors, and I am very grateful to them for agreeing to it being shared. As they put it in the original (2015) preface to the book:

Since the vast majority of the sources consulted are freely available on the London Lives website, this book is best read online, allowing you to click through directly from the primary sources cited and quoted in the text to transcriptions and images of the original documents. Where possible, we have also linked to modern secondary literature and to printed primary sources… We hope that these links will facilitate a new approach to reading monographs in which readers switch back and forth between the original sources, the contextual secondary interpretation, and the monograph itself - gaining a deeper understanding of the period and argument.

The new version of the book has been created in order to realise those hopes more fully than had been possible with the format limitations of the 2015 edition. This companion website is intended as a further aid to future similar endeavours, by documenting one possible way to go about such a task.

However, the site is not intended to serve as a tutorial. There are some fairly extensive notes on chapter 2, to give an idea of my approach to the tasks, but only code comments and occasional notes in subsequent code chapters. Nonetheless, it may be helpful for eg people who’ve worked through the basic R data wrangling lessons at the Programming Historian, and are looking for examples and practice material using real-world data that often needs tidying and reshaping before it can be visualised.

The visualisations and site development

The 2015 edition of the London Lives book contained a number of graphs that were severely constrained by the demands of traditional book formats: they were small, sometimes difficult to interpret and entirely in black and white. One of my priorities in converting the book to a new online edition was to recreate the graphs as faithfully as possible but (as with many other features of the new edition) to make better use of the online medium. I decided against making the graphs interactive, but I did want to make them clearer to read, with better use of space and colour.

See the appendix for fuller details of the methods used to create the visualisations and build the website for the book. All the visualisations were made in R, using the Tidyverse and ggplot. The website was built using the rmarkdown package.

Running the code

The .Rmd files (and data) can be found here.

Using the .Rmd files, it should in theory be possible to replicate the graphs using the code and the datasets, but I can’t guarantee they’ll work without any adjustments in every environment. (The book was built in 2020 on a MacBook running High Sierra (OS X 10.13.6), R v3.5 and RStudio v1.2.) If you have difficulties, I may be able to answer simple queries on Twitter (@sharon_howard).

List of contents

The structure of this site mirrors that of the ebook, apart from the Appendix. Only chapters 2 to 7 in the book contain any graphs.

Full information about the datasets’ original sources is in the book or the spreadsheets themselves.

Appendix: building a book and a website

  • using R/Markdown/RMarkdown
  • visualisations, colours and accessibility
  • website development


A few R resources:


Text and code at this site is shared under a Creative Commons Attribution Share-Alike licence (CC BY-SA). The accompanying spreadsheets are shared under a Creative Commons Attribution Non-Commercial licence (CC BY-NC 4.0).