Skip to content

Commit

Permalink
Add IMD 2019 England underlying indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewgthomas committed Aug 6, 2024
1 parent e6c9b31 commit 193e65e
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
Binary file modified R/sysdata.rda
Binary file not shown.
51 changes: 51 additions & 0 deletions data-raw/imd2019_england_lsoa11_indicators.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
library(tidyverse)
library(compositr)
library(readxl)

# Load package
devtools::load_all(".")

# Set query url
query_url <-
query_urls |>
filter(data_set == "imd_england_indicators") |>
pull(query_url)

tf <- download_file(query_url, ".xlsx")

imd_sheets <-
excel_sheets(tf) |>
set_names()

imd_sheets <- imd_sheets[-1] # Don't need 'Notes' worksheet

# imd_indicators <-
# imd_sheets |>
# map_df(~read_excel(tf, sheet = .x))
#
# imd_indicators |>
# select(-`LSOA name (2011)`, -`Local Authority District code (2019)`, -`Local Authority District name (2019)`) |>
# rename(lsoa11_code = `LSOA code (2011)`)

imd_income <- read_excel(tf, sheet = imd_sheets[1])
imd_employment <- read_excel(tf, sheet = imd_sheets[2])
imd_education <- read_excel(tf, sheet = imd_sheets[3])
imd_health <- read_excel(tf, sheet = imd_sheets[4])
imd_barriers <- read_excel(tf, sheet = imd_sheets[5])
imd_env <- read_excel(tf, sheet = imd_sheets[6])

imd2019_england_lsoa11_indicators <-
imd_income |>
left_join(imd_employment) |>
left_join(imd_education) |>
left_join(imd_health) |>
left_join(imd_barriers) |>
left_join(imd_env)

imd2019_england_lsoa11_indicators <-
imd2019_england_lsoa11_indicators |>
select(-`LSOA name (2011)`, -`Local Authority District code (2019)`, -`Local Authority District name (2019)`) |>
rename(lsoa11_code = `LSOA code (2011)`)

# Save output to data/ folder
usethis::use_data(imd2019_england_lsoa11_indicators, overwrite = TRUE)
1 change: 1 addition & 0 deletions data-raw/query_urls.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ query_urls <-
"imd_lsoa_england", "imd", "LSOA-level deprivation in England", "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/845345/File_7_-_All_IoD2019_Scores__Ranks__Deciles_and_Population_Denominators_3.csv", "https://www.gov.uk/government/statistics/english-indices-of-deprivation-2019",
"imd_lad_england", "imd", "Local Authority deprivation in England", "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/833995/File_10_-_IoD2019_Local_Authority_District_Summaries__lower-tier__.xlsx", "https://www.gov.uk/government/statistics/english-indices-of-deprivation-2019",
"imd_england_subdomains", "imd", "Sub-domains of LSOA-level deprivation in England", "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/833976/File_4_-_IoD2019_Sub-domains_of_Deprivation.xlsx", "https://www.gov.uk/government/statistics/english-indices-of-deprivation-2019",
"imd_england_indicators", "imd", "File 8: underlying indicators", "https://assets.publishing.service.gov.uk/media/5d8b3cd740f0b609909b590a/File_8_-_IoD2019_Underlying_Indicators.xlsx", "https://www.gov.uk/government/statistics/english-indices-of-deprivation-2019",
# Wales
"imd_lsoa_wales", "imd", "LSOA-level deprivation in Wales", "https://gov.wales/sites/default/files/statistics-and-research/2019-11/welsh-index-multiple-deprivation-2019-index-and-domain-ranks-by-small-area.ods", "https://gov.wales/welsh-index-multiple-deprivation-full-index-update-ranks-2019",
"imd_lsoa_wales_scores", "imd", "LSOA-level deprivation scores in Wales", "https://gov.wales/sites/default/files/statistics-and-research/2019-12/wimd-2019-index-and-domain-scores-by-small-area_0.ods", "https://gov.wales/welsh-index-multiple-deprivation-full-index-update-ranks-2019",
Expand Down
Binary file added data/imd2019_england_lsoa11_indicators.rda
Binary file not shown.

0 comments on commit 193e65e

Please sign in to comment.