# Aim: get IMD scores and mode split data at the LSOA level
# Works for any Local Authority in England:
la_name = "Richmondshire"
remotes::install_cran("snakecase")
#> Skipping install of 'snakecase' from a cran remote, the SHA1 (0.9.2) has not changed since last install.
#> Use `force = TRUE` to force installation
remotes::install_github("itsleeds/pct", "national")
#> Skipping install of 'pct' from a github remote, the SHA1 (3fb93eab) has not changed since last install.
#> Use `force = TRUE` to force installation
remotes::install_github("robinlovelace/ukboundaries")
#> Skipping install of 'ukboundaries' from a github remote, the SHA1 (1d162f0d) has not changed since last install.
#> Use `force = TRUE` to force installation
u <- "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/467774/File_7_ID_2015_All_ranks__deciles_and_scores_for_the_Indices_of_Deprivation__and_population_denominators.csv"
d <- readr::read_csv(u)
#> Parsed with column specification:
#> cols(
#> .default = col_double(),
#> `LSOA code (2011)` = col_character(),
#> `LSOA name (2011)` = col_character(),
#> `Local Authority District code (2013)` = col_character(),
#> `Local Authority District name (2013)` = col_character()
#> )
#> See spec(...) for full column specifications.
names(d) <- snakecase::to_snake_case(names(d))
names(d)[1] = "geo_code"
# pct package download
z <- pct::get_pct(layer = "z", geography = "lsoa", national = TRUE)
#> Loading required package: sp
zm <- dplyr::inner_join(z, d)
#> Joining, by = "geo_code"
# zm
zm_lds = zm[grepl(pattern = la_name, x = zm$geo_name), ]
plot(zm_lds[c("all", "bicycle", "car_driver", "index_of_multiple_deprivation_imd_score")])
This code should do it for any LA.
Results for Richmondshire: https://github.com/ITSLeeds/SSPA/releases/download/V1.8.2/lsoa-imd-census-commute-transport-mode-data-Richmondshire.gpkg
Reproducible example:
Created on 2019-03-26 by the reprex package (v0.2.1)
Thanks to @eugenividal for helping with this.