Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
.Ruserdata
archive/
docs

data-raw/welsh-index-of-multiple-deprivation-wimd-2025-local-authority-deprivation-profiles-v4.csv
data-raw/welsh-index-of-multiple-deprivation-wimd-2025-middle-layer-super-output-area-msoa-deprivation-profiles-v4.csv
45 changes: 44 additions & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ NULL
#' \item{Housing_score}{Housing domain score}
#' \item{Crime_score}{Community safety domain score}
#' \item{Environment_score}{Physical environment domain score}
#' \item{Category_of_deeprooted_deprivation}{
#' \item{category_of_deeprooted_deprivation}{
#' Four categories of deep-rooted deprivation:
#' \cr 1. LSOAs in deep rooted deprivation: These LSOAs have remained in the top 50 most deprvied for the last 6 publications of WIMD ranks.
#' \cr 2. LSOAs often ranked in top 50 most deprived: These LSOAs have been in the top 50 most deprived for between 3 and 5 of the last 6 publications of WIMD ranks.
Expand All @@ -484,6 +484,49 @@ NULL
#' @source \url{https://www.gov.wales/welsh-index-multiple-deprivation-2025}
"imd2025_wales_lsoa21"

#' Index of Multiple Deprivation for LTLAs (2025) in Wales
#'
#' A data set containing deprivation groups for Lower Tier Local Authorities (LTLAs) in Wales.
#' The WIMD is calculated at LSOA level. To compare larger geographies, consider the proportion of small
#' area in a larger geography which are in the most deprived (say) 10 percent of areas in Wales.This table
#' provides numbers and percentages of LSOAs within a given local authority which are in these categories of deprivation:
#' 10percent, 20percent, 30percent, 50percent most deprived overall and for each of the 8 domains.
#'
#'
#' @format A data frame of class "tbl"
#' \describe{
#' \item{ltla24_code}{LTLA code}
#' \item{domain}{Domain}
#' \item{deprivation_group}{Deprivation group}
#' \item{data_description}{Data unit - number or percentage}
#' \item{data_values}{Value}
#' ...
#' }
#' @source \url{https://stats.gov.wales/en-GB/f30cc8bc-8e97-449e-96a4-77b0400262d1#about}
"imd2025_wales_ltla24"


#' Index of Multiple Deprivation for MSOAs (2025) in Wales
#'
#' A data set containing deprivation groups for Middle Super Output Areas (MSOA) in Wales.
#' The WIMD is calculated at LSOA level. To compare larger geographies, consider the proportion of small
#' area in a larger geography which are in the most deprived (say) 10 percent of areas in Wales.This table
#' provides numbers and percentages of LSOAs within a given local authority which are in these categories of deprivation:
#' 10percent, 20percent, 30percent, 50percent most deprived overall and for each of the 8 domains.
#'
#'
#' @format A data frame of class "tbl"
#' \describe{
#' \item{msoa21_code}{MSOA code}
#' \item{domain}{Domain}
#' \item{deprivation_group}{Deprivation group}
#' \item{data_description}{Data unit - number or percentage}
#' \item{data_values}{Value}
#' ...
#' }
#' @source \url{https://stats.gov.wales/en-GB/f30cc8bc-8e97-449e-96a4-77b0400262d1#about}
"imd2025_wales_msoa21"

#' Index of Multiple Deprivation for LSOAs (2011) in England
#'
#' A data set containing IMD scores and deciles for Lower Layer Super
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
32 changes: 32 additions & 0 deletions data-raw/imd2025_wales_ltla24.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
library(tidyverse)
library(httr2)

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

# Query URL constructed using https://api.stats.gov.wales/v1/docs/#/
# Dataset ID taken from URL link https://stats.gov.wales/en-GB/f30cc8bc-8e97-449e-96a4-77b0400262d1

query_url <-
query_urls |>
filter(data_set == "imd2025_ltla24_wales") |>
pull(query_url)

response <- request(query_url) |>
req_perform()

csv_text <- resp_body_string(response)

raw <- read_csv(csv_text)

imd2025_wales_ltla24 <- raw |>
select(
ltla24_code = `Area code`,
domain = Domain,
deprivation_group = `Deprivation group`,
data_description = `Data description`,
data_values = `Data values`
)

# Save output to data/ folder
usethis::use_data(imd2025_wales_ltla24, overwrite = TRUE)
32 changes: 32 additions & 0 deletions data-raw/imd2025_wales_msoa21.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
library(httr2)
library(tidyverse)

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

# Query URL constructed using https://api.stats.gov.wales/v1/docs/#/
# Dataset ID taken from URL link https://stats.gov.wales/en-GB/d22b81a1-6c99-4527-986b-2a529567cfba

query_url <-
query_urls |>
filter(data_set == "imd2025_msoa21_wales") |>
pull(query_url)

response <- request(query_url) |>
req_perform()

csv_text <- resp_body_string(response)

raw <- read_csv(csv_text)

imd2025_wales_msoa21 <- raw |>
select(
msoa21_code = `Area code`,
domain = Domain,
deprivation_group = `Deprivation group`,
data_description = `Data description`,
data_values = `Data values`
)

# Save output to data/ folder
usethis::use_data(imd2025_wales_msoa21, overwrite = TRUE)
2 changes: 2 additions & 0 deletions data-raw/query_urls.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ query_urls <-
"imd2025_lsoa21_wales_ranks" , "imd" , "LSOA-level deprivation in Wales, ranks" , "https://www.gov.wales/sites/default/files/statistics-and-research/2025-11/wimd-2025-index-and-domain-ranks-by-small-area.ods" , "https://www.gov.wales/welsh-index-multiple-deprivation-2025" ,
"imd2025_lsoa21_wales_scores" , "imd" , "LSOA-level deprivation in Wales, scores" , "https://www.gov.wales/sites/default/files/statistics-and-research/2025-12/wimd-2025-index-and-domain-scores-by-small-area.ods" , "https://www.gov.wales/welsh-index-multiple-deprivation-2025" ,
"imd2025_lsoa21_wales_deeprooteddep" , "imd" , "LSOA-level deprivation in Wales, deep rooted deprivation" , "https://www.gov.wales/sites/default/files/statistics-and-research/2025-11/welsh-index-of-multiple-deprivation-wimd-2025-data-underlying-deep-dooted-deprivation-analysis.ods" , "https://www.gov.wales/welsh-index-multiple-deprivation-2025" ,
"imd2025_msoa21_wales" , "imd" , "MSOA-level deprivation in Wales, categories" , "https://api.stats.gov.wales/v1/d22b81a1-6c99-4527-986b-2a529567cfba/download/csv" , "https://stats.gov.wales/en-GB/d22b81a1-6c99-4527-986b-2a529567cfba" ,
"imd2025_ltla24_wales" , "imd" , "LTLA-level deprivation in Wales, categories" , "https://api.stats.gov.wales/v1/f30cc8bc-8e97-449e-96a4-77b0400262d1/download/csv" , "https://stats.gov.wales/en-GB/d22b81a1-6c99-4527-986b-2a529567cfba" ,

"imd_lsoa_wales" , "imd" , "LSOA-level deprivation in Wales" , "https://www.gov.wales/sites/default/files/statistics-and-research/2022-02/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://www.gov.wales/sites/default/files/statistics-and-research/2022-02/wimd-2019-index-and-domain-scores-by-small-area.ods" , "https://gov.wales/welsh-index-multiple-deprivation-full-index-update-ranks-2019" ,
Expand Down
Binary file added data/imd2025_wales_ltla24.rda
Binary file not shown.
Binary file added data/imd2025_wales_msoa21.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion man/imd2025_wales_lsoa21.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions man/imd2025_wales_ltla24.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions man/imd2025_wales_msoa21.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.