Introduction to parlitools

Evan Odell

2019-05-30

Introduction to parlitools

parlitools is a collection of datasets, maps and data retrieval functions for analysing UK politics.

Vignettes

In addition to this introductory vignette, there are vignettes on using parlitools with cartogram, the British Election Study dataset and mapping local authorities.

Included Data

party_colours - A tibble with the ID, name and hex code for the official colour of a variety of political parties, taken from Wikipedia. Includes all political parties with MPs and a number without MPs. (Sources: https://en.wikipedia.org/wiki/Wikipedia:Index_of_United_Kingdom_political_parties_meta_attributes, mnis::ref_parties())

bes_2015 - A tibble with the British Election Study 2015 Constituency Results Version 2.2. For information on all the variables in this dataset, see the bes-2015 vignette (Source: http://www.britishelectionstudy.com/data-object/2015-bes-constituency-results-with-census-and-candidate-data/)

leave_votes_west - The percentage of votes cast for leave in the 2016 EU referendum. Some constituencies have actual results and others only have estimates by Chris Hanretty; in cases where the actual cote count is known, both the estimates and the actual results are reported. (Sources: Hanretty, C. (2017). Areal interpolation and the UK’s referendum on EU membership. Journal of Elections, Public Opinion and Parties, 27(4), 466–483. https://doi.org/10.1080/17457289.2017.1287081)

Data Retrieval Functions

current_mps - Uses functions from hansard and mnis to create a tibble with data on all current MPs, their party affiliation and their constituency.

mps_on_date - Uses functions from hansard and mnis to create a tibble with data on all MPs from a given date, their party affiliation and their constituency.

Included Maps

west_hex_map - A hexagonal cartogram, stored as a simple feature and data frame, of Westminster parliamentary constituencies. west_hex_map can be used to create maps like this:

local_hex_map - Hexagonal cartogram, A hexagonal cartogram, stored as a simple feature and data frame, of all Local Authorities in England, Wales and Scotland.

Other Data Sources

There are a variety of potentially relevant data sources and datasets on UK politics, far too many for me to include them all in this package, and many of which are far too large. This list is by no means complete:

Using parlitools

Creating a hexagonal map of constituencies

Create a hexagonal map of all constituency MPs, at the time Parliament was dissolved for the 2017 General Election.

The code below creates a hexagonal map of UK constituency MPs, as of 20 June 2017.

Creating a leaflet map:

Mapping Parliamentary Petitions

The UK Parliamentary Petition site has facilities for mapping which parliamentary constituencies signatories of petitions live in. However, it only produces geographic maps, not hexagrams.

I have the petition ‘Prevent Donald Trump from making a State Visit to the United Kingdom’, both of which attracted 1,863,565 signatures.

Anti-Trump petition signatories