A collection of useful tools for UK politics, including base maps and datasets. Initially inspired by Bhaskar Karambelkar's tilegrams
package, but with the ability to create a hexagonal map of UK parliamentary constituencies. The package also includes functions for data retrieval of current MPs and their consituency details (as it requires calls to two different APIs, this function is not included in my hansard
or mnis
packages), and data from the 2015 UK General Election, courtesy of the British Election Study.
At present parlitools
is only available on GitHub, although a CRAN release is being planned, ahead of the 2017 UK General Election.
To install the current version from GitHub, run:
devtools::install_github("evanodell/parlitools")
You will also need the development version of mnis
if your installed version is v0.2.3 (the current version on CRAN) or less:
devtools::install_github("evanodell/mnis")
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.
bes_2015
- A tibble with the British Election Study 2015 Constituency Results Version 2.2. (Source: http://www.britishelectionstudy.com/data-object/2015-bes-constituency-results-with-census-and-candidate-data/)
current_mps
- Uses functions from hansard
and mnis
to create a tibble with data on all current MPs, their party affiliation and their constituency.
west_hex_map
- A hexagonal cartogram, stored as a simple feature and data frame, of Westminster parliamentary constituencies, which you can use to create maps like this:
parlitools
For more details, please see the vignette.
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.
Electoral Commission - Electoral results dating back to 2005.
British Election Study - A large selection of open data, including panel surveys, linked data and aggregated Twitter data, covering elections and referenda.
hansard
& mnis
data retrieval packages for parliamentary APIs.