Mapping terrorist attacks in London

For this exercise, you should create the R code needed to make a basic map of the locations of fatal terrorist attacks in London between 2010 and 2018.

Before you start

Complete Chapters 1–3 of Learn Crime Mapping with R.

In this exercise you will practise downloading and reading data, filtering rows, converting coordinates into a spatial object, and creating a point map. The coordinate-system codes needed for this dataset are supplied below.

What your map should show

Your map should show the locations of individual incidents between 1 January 2010 and 31 December 2018, inclusive. You can download the data from:

https://mpjashby.github.io/crimemappingdata/london_attacks.csv

The dataset documentation describes the columns and source. The dataset also contains incidents outside the period you have been asked to produce the map for, so you will need to remove some rows in the data before making the map.

This dataset uses the WGS84 coordinate reference system, which has the EPSG code EPSG:4326. Before creating the map you should transform the dataset to use the British National Grid coordinate system (EPSG:27700).

Checklist for this exercise

You can use this checklist to make sure you have done everything required for this exercise.

The map

  • The map shows the locations of individual incidents between 2010 and 2018, inclusive.
  • The map includes a background map so viewers can identify the locations.
  • The points use a colour that stands out from the background.

The code

  • There is no temporary code – e.g. head(), excel_sheets(), install.packages(), etc. – in your script file.
  • The code loads the necessary packages at the start of the script in a single call to the pacman::p_load() function.
  • The code uses request() and req_perform() to download the data to a local file in the data/raw folder.
  • The code uses here() to specify file paths within your workspace.
  • The code loads the downloaded local file into R.
  • The code keeps only incidents within the required dates.
  • The code converts the filtered data to a simple features (SF) object using EPSG:4326.
  • The code transforms the dataset to use a local coordinate reference system.
  • The script contains all the code needed to produce the map.

Check your answer

After attempting the task, you can read this specimen answer and explanation to get an idea of what a potential solution looks like.