Contents

This book is divided into 17 chapters, each covering a different topic related to crime mapping with R. Some of the chapters focus on mapping skills, while others focus more on how good coding practice can make your life easier. The chapters build on one another, so the easiest way to go through the book is to work through the chapters in order. But if you already know some R coding, and something about mapping, you might want to jump into a specific chapter to get what you need.

Before you start, make sure you install the software you need for this book.

Chapter 1: Getting Started
Get started with crime mapping by learning about why putting crime on maps is useful, and get a tour of the RStudio software we will use throughout this course.
Chapter 2: Your first crime map
Quickly walk (or jog) through the process of creating a complete crime map in R.
Chapter 3: Wrangling data
Learn the building blocks of data analysis: loading, filtering, manipulating and saving data for crime mapping.
Chapter 4: Your second crime map
Walk through each specific stage in the process of creating a crime map.
Chapter 5: Code with style
Learn how to format your code so that it is easier to use, both for you and for others.
Chapter 6: Mapping crime patterns
Learn how to use maps to identify patterns of crime in cities.
Chapter 7: Giving a map context
Learn how to make your maps easier to understand using supporting elements such as titles and legends.
Chapter 8: Handling bugs in your code
Learn how to find and fix problems with the R code that you write.
Chapter 9: Mapping area data
Learn how to make thematic (choropleth) maps that use data for areas to accomplish tasks such as mapping crime rates.
Chapter 10: Using data about places
Learn how to find and use additional spatial data to improve your crime maps, for example by adding the locations of local facilities that might be important in generating patterns of crime.
Chapter 11: Mapping hotspots
Learn how to identify which areas have more crime than we would expect by chance, and how to map the the density of crime risk.
Chapter 12: Handling messy data
Learn how to handle different types of messy data and transform them into tidy data that is easier to analyse.
Chapter 13: Mapping crime series
Learn how to map serial crimes and spree crimes, as well as how to combine multiple maps in R.
Chapter 14: Writing reports in R
Learn how to use Markdown and Quarto to write reports in RStudio, and how writing reproducible reports makes your analysis more reliable.
Chapter 15: Presenting spatial data without maps
Learn how to use tables and different types of charts to communicate spatial information about crime in circumstances where maps are not the best choice.
Chapter 16: Mapping crime over time
Learn how spatial concentrations of crime vary over time, how to analyse spatio-temporal crime patterns and how to make animated maps.
Important things you should know

Throughout the book you will see boxes marked with an exclamation mark that contain information that it is particularly important for you to know to avoid common mistakes in writing code or making maps. Pay special attention to these points and remember to ask questions if anything isn’t clear.

In this book you will also see lines of text marked by a light-bulb symbol that you can click on to find out more information about a particular issue. This is generally information that you do not need to know to complete a task, but which might be useful in other circumstances or which might answer some questions that you have. You can skip these boxes if you want to, or come back to them later if you have a question.

How to use this book

Finally, you will see boxes like this one throughout the book that give you the opportunity to check your understanding of a particular section of that chapter. Sometimes this will be in the form of a multiple-choice question, and sometimes you’ll be asked to write some code in the R Console. You will always be able to check if your answers are correct.