diff --git a/.gitignore b/.gitignore index 3ff6bd2..5cb275e 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/R/data.R b/R/data.R index 9d73373..bed4464 100644 --- a/R/data.R +++ b/R/data.R @@ -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. @@ -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 diff --git a/R/sysdata.rda b/R/sysdata.rda index 9386158..e32d2d8 100644 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/data-raw/imd2025_wales_ltla24.R b/data-raw/imd2025_wales_ltla24.R new file mode 100644 index 0000000..99cdd20 --- /dev/null +++ b/data-raw/imd2025_wales_ltla24.R @@ -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) diff --git a/data-raw/imd2025_wales_msoa21.R b/data-raw/imd2025_wales_msoa21.R new file mode 100644 index 0000000..5b3f4c1 --- /dev/null +++ b/data-raw/imd2025_wales_msoa21.R @@ -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) diff --git a/data-raw/query_urls.R b/data-raw/query_urls.R index 15860d8..bdc9e6c 100644 --- a/data-raw/query_urls.R +++ b/data-raw/query_urls.R @@ -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" , diff --git a/data/imd2025_wales_ltla24.rda b/data/imd2025_wales_ltla24.rda new file mode 100644 index 0000000..2003668 Binary files /dev/null and b/data/imd2025_wales_ltla24.rda differ diff --git a/data/imd2025_wales_msoa21.rda b/data/imd2025_wales_msoa21.rda new file mode 100644 index 0000000..186295e Binary files /dev/null and b/data/imd2025_wales_msoa21.rda differ diff --git a/man/imd2025_wales_lsoa21.Rd b/man/imd2025_wales_lsoa21.Rd index 7699de0..3807c6e 100644 --- a/man/imd2025_wales_lsoa21.Rd +++ b/man/imd2025_wales_lsoa21.Rd @@ -37,7 +37,7 @@ A data frame of class "tbl": \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. diff --git a/man/imd2025_wales_ltla24.Rd b/man/imd2025_wales_ltla24.Rd new file mode 100644 index 0000000..0bb7111 --- /dev/null +++ b/man/imd2025_wales_ltla24.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{imd2025_wales_ltla24} +\alias{imd2025_wales_ltla24} +\title{Index of Multiple Deprivation for LTLAs (2025) in Wales} +\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} +} +\usage{ +imd2025_wales_ltla24 +} +\description{ +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. +} +\keyword{datasets} diff --git a/man/imd2025_wales_msoa21.Rd b/man/imd2025_wales_msoa21.Rd new file mode 100644 index 0000000..ab2be0e --- /dev/null +++ b/man/imd2025_wales_msoa21.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{imd2025_wales_msoa21} +\alias{imd2025_wales_msoa21} +\title{Index of Multiple Deprivation for MSOAs (2025) in Wales} +\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} +} +\usage{ +imd2025_wales_msoa21 +} +\description{ +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. +} +\keyword{datasets}