ukgeog
is a simple package to facilitate the easy download of official
spatial data sets of the UK. It includes a wide range of geospatial
data, provided as simple feature sf
objects (like
shapefiles but better). Making it easy to make Choropleth
Maps with base R
, as
well as with popular packages such as
ggplot2
and
leaflet
.
Other functions are provided to create UK Local Authority (LA) lookups, across time and between lower and upper tiers.
# install.packages("remotes")
remotes::install_github("l-hodge/ukgeog")
available_sf
returns a list of available boundaries
select_sf
can be used to interactively select a set of boundaries
to download
read_sf
can be used to download boundaries for the following
geographies using the ‘geog’ and ‘year’ arguments:
| ‘geog’ | Geography | Year | |:-------|:----------------------------------------------|:-----------------------| | UTLA | Counties and Unitary Authorities | 2018; 2019; 2020; 2021 | | NAT | Countries | 2018; 2019; 2020; 2021 | | EU | European Electoral Regions | 2018 | | LAD | Local Authority Districts | 2018; 2019; 2020; 2021 | | LSOA | Lower Super Output Areas | 2001; 2011 | | MSOA | Middle Super Output Areas | 2001; 2011 | | WAC | National Assembly for Wales Constituencies | 2018 | | WAR | National Assembly for Wales Electoral Regions | 2018 | | NUTS1 | NUTS Level 1 | 2015; 2018 | | NUTS2 | NUTS Level 2 | 2015; 2018 | | NUTS3 | NUTS Level 3 | 2015; 2018 | | OA | Output Area | 2001; 2011 | | GOR | Regions | 2018; 2019; 2020; 2021 | | WM | Westminster Parliamentary Constituencies | 2018; 2019; 2020; 2021 |
library(ukgeog)
# Read in simple feature of the countries that make up the UK
sf <- read_sf("NAT", year = 2021)
across_yr_lookup
creates lookups across time to account for
boundary changeswithin_yr_lookup
creates within year lookups between LAD’s and
UTLA’sconvert_lnglat
converts Eastings/Northings to Latitude/Longitudeukgeog
Original shapefiles are created by the Office for National Statistics (ONS) and are available from the Open Geography Portal.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.