|
| 1 | +# English Indices of Deprivation 2025 # |
| 2 | +# Indices of Deprivation: Education, Skills and Training # |
| 3 | + |
| 4 | +# Source: Ministry of Housing, Communities and Local Government |
| 5 | +# Publisher URL: https://www.gov.uk/government/statistics/english-indices-of-deprivation-2025 |
| 6 | +# Licence: Open Government Licence 3.0 |
| 7 | + |
| 8 | +# MHCLG does not publish the Indices of Deprivation at ward level. |
| 9 | +# Ward level data produced according to the Appendix A. How to aggregate to different geographies of the English Indices of Deprivation 2019 Research report |
| 10 | + |
| 11 | +library(sf) ; library(tidyverse) ; library(janitor) ; library(jsonlite) |
| 12 | + |
| 13 | +la<-"Trafford" |
| 14 | + |
| 15 | +#df <- read_csv("https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/833982/File_7_-_All_IoD2019_Scores__Ranks__Deciles_and_Population_Denominators.csv") %>% |
| 16 | +df <- read_csv("https://assets.publishing.service.gov.uk/media/691ded56d140bbbaa59a2a7d/File_7_IoD2025_All_Ranks_Scores_Deciles_Population_Denominators.csv") %>% |
| 17 | + |
| 18 | + clean_names() %>% |
| 19 | + filter(`local_authority_district_name_2024`==la) %>% |
| 20 | + select(lsoa21cd = "lsoa_code_2021", score = "education_skills_and_training_score", population = "total_population_mid_2022") %>% |
| 21 | + mutate(indicator="Indices of Deprivation: Education, Skills and Training") |
| 22 | + |
| 23 | +# LSOA to ward lookup # |
| 24 | + |
| 25 | +# Source: ONS Open Geography Portal |
| 26 | +# Publisher URL: http://geoportal.statistics.gov.uk/ |
| 27 | +# Licence: Open Government Licence 3.0 |
| 28 | + |
| 29 | +# Best-fit lookup between LSOAs and wards |
| 30 | +#lookup <- read_csv("https://opendata.arcgis.com/datasets/8c05b84af48f4d25a2be35f1d984b883_0.csv") %>% |
| 31 | + |
| 32 | +lookup <- fromJSON(paste0("https://services1.arcgis.com/ESMARspQHYMw9BZ9/arcgis/rest/services/LSOA21_WD25_LAD25_EW_LU_v2/FeatureServer/0/query?where=LAD25NM%20%3D%20'", URLencode(toupper("Trafford"), reserved = TRUE), "'&outFields=LSOA21CD,LSOA21NM,WD25CD,WD25NM,LAD25CD,LAD25NM&outSR=4326&f=json"), flatten = TRUE) %>% |
| 33 | + pluck("features") %>% |
| 34 | + as_tibble() %>% |
| 35 | + select(lsoa21cd = attributes.LSOA21CD, area_code = attributes.WD25CD, area_name = attributes.WD25NM) |
| 36 | + |
| 37 | +#IoD lsoa to ward |
| 38 | + |
| 39 | +iod_ward <- left_join(df, lookup, by = "lsoa21cd") %>% |
| 40 | + group_by(area_code, area_name, indicator) %>% |
| 41 | + summarise(ward_score=sum(score*population)/sum(population)) %>% |
| 42 | + ungroup %>% |
| 43 | + mutate(period="2025",unit ="Score", measure = "Weighted Score", value = round(ward_score, digits = 1)) %>% |
| 44 | + select(area_code, area_name, indicator, period, measure, unit, value) |
| 45 | + |
| 46 | +write_csv (iod_ward, "../data/education_deprivation.csv") |
0 commit comments