From 8d0613f4d43200b6c7288814596559637a3bae66 Mon Sep 17 00:00:00 2001 From: CatReid Date: Thu, 14 Nov 2024 10:47:59 +0000 Subject: [PATCH 01/78] First draft young-peoples-training First draft young-peoples-training. Styled, but to be rendered. data.R and metadata still to be updated./ --- data/lives_young_peoples_training.rda | Bin 0 -> 328 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 data/lives_young_peoples_training.rda diff --git a/data/lives_young_peoples_training.rda b/data/lives_young_peoples_training.rda new file mode 100644 index 0000000000000000000000000000000000000000..ef677bb072a967299d45a5720429ad180b0333c1 GIT binary patch literal 328 zcmV-O0k{4_T4*^jL0KkKS-XX%{{R6a|Lp(2NF)FO|KLOg5Wv5u-=IMN05AvuKn4N< zumKn(H8n=mdY**Pc_1_ffB~QZ>S^f*G{nG0m=T0v0007E7zrXl5w$m|8Z-}4p@;#R zH36g4ZAFj`sv{DMw;U3I7q1f&K(5_)Q7Z<9rri($DxV2F!Z@>Ic=Sut)srr3+NgcV zg)9Ni05A$Afw4g-Aisu5f>k>^Ap+03=ynJ-=nhr)GDiL60f{0B8PX)daBH%pb|hR# z@krZ|B5Vs|!I3gXn`x2DQ#;p2RE(NM;LB4PG4}PAIM8n6=*Z`jgUQ|YPGiVxjFi*^ z!L-q^(|oLG$dU9Z_r$nyAjyTZ0;-Y=7NIqem=#9(Tp$iaz4F*~(E&*di{l?K45sob af^*Onx9yTu<^1Cf{x0N-aG@c03r+r5T#wTL literal 0 HcmV?d00001 From 14bad71568e30206c729d7e3d7e4010b75f4f971 Mon Sep 17 00:00:00 2001 From: CatReid Date: Thu, 14 Nov 2024 11:04:02 +0000 Subject: [PATCH 02/78] First draft completed young-peoples-training First draft completed young-peoples-training, styled and rendered. data.R and metadata updated. --- R/data.R | 18 +++++++ .../healthy-lives/young-peoples-training.R | 53 ++++++++++--------- man/lives_young_peoples_training.Rd | 28 ++++++++++ metadata.md | 2 +- 4 files changed, 76 insertions(+), 25 deletions(-) create mode 100644 man/lives_young_peoples_training.Rd diff --git a/R/data.R b/R/data.R index 4475ebb..d369c90 100644 --- a/R/data.R +++ b/R/data.R @@ -49,3 +49,21 @@ #' @source \url{https://data.nisra.gov.uk/} #' "lives_pupil_absence" + +#' Percentage of Young People in Education, Employment, and Training (2022/23) +#' +#' A dataset containing statistics on the percentage of young people (aged 16-18) +#' who are in education, employment, and training. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{young_peoples_eet_percentage}{Percentage of young people (aged 16-18 in +#' Years 12-14) who are in education, employment, and training} +#' \item{year}{School Year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +#' +"lives_young_peoples_training" diff --git a/data-raw/healthy-lives/young-peoples-training.R b/data-raw/healthy-lives/young-peoples-training.R index 85634a4..b0fae20 100644 --- a/data-raw/healthy-lives/young-peoples-training.R +++ b/data-raw/healthy-lives/young-peoples-training.R @@ -1,29 +1,34 @@ +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readODS) -GET( - "https://www.ninis2.nisra.gov.uk/Download/Children%20Education%20and%20Skills/School%20Leavers%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) +# ---- Get and clean data ---- +# Young Peoples Training, Education, and Employment +# Source: https://data.nisra.gov.uk/ +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/DESLSDLGD/CSV/1.0/" +young_peoples_raw <- read_csv(url) -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "A4:S15" - ) - -raw_tibble <- - raw |> - as_tibble() - -young_people <- - raw_tibble |> +lives_young_peoples_training <- young_peoples_raw |> + filter( + UNIT == "%", + FSME == "All", + `Academic Year` == "2022/23", + `Statistic Label` %in% c( + "% of School Leavers with Destination: Higher Education", + "% of School Leavers with Destination: Further Education", + "% of School Leavers with Destination: Employment", + "% of School Leavers with Destination: Training" + ) + ) |> + group_by(LGD2014) |> + mutate(young_peoples_eet_percentage = sum(VALUE, na.rm = TRUE)) |> + distinct(LGD2014, .keep_all = TRUE) |> select( - lad_code = `LGD2014 Code`, - young_people_unemployed_unknown_percent = `Destination: Unemployed/Unknown (%)` - ) + ltla24_code = LGD2014, + young_peoples_eet_percentage, + year = `Academic Year` + ) |> + ungroup() |> + slice(-12) -# Save -write_rds(young_people, "data/vulnerability/health-inequalities/northern-ireland/healthy-lives/young-peoples-training.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(lives_young_peoples_training, overwrite = TRUE) diff --git a/man/lives_young_peoples_training.Rd b/man/lives_young_peoples_training.Rd new file mode 100644 index 0000000..650f415 --- /dev/null +++ b/man/lives_young_peoples_training.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{lives_young_peoples_training} +\alias{lives_young_peoples_training} +\title{Percentage of Young People in Education, Employment, and Training (2022/23)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{young_peoples_eet_percentage}{Percentage of young people (aged 16-18 in +Years 12-14) who are in education, employment, and training} +\item{year}{School Year} + +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +lives_young_peoples_training +} +\description{ +A dataset containing statistics on the percentage of young people (aged 16-18) +who are in education, employment, and training. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 96cb2fb..812a73a 100644 --- a/metadata.md +++ b/metadata.md @@ -11,7 +11,7 @@ | Healthy Lives | Early Years Development | NA | [NISRA](https://datavis.nisra.gov.uk/dissemination/NINIS-redirect.html) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data unavailable - contact statistics@education-ni.gov.uk | :x: | | Healthy Lives | Pupil Absence | 2021/22 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage of unauthorised school absences| :heavy_check_mark: | | Healthy Lives | GCSE Achievement | 2022-23 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage of GSCE attainment, including Maths and English (Grades A-C) | :heavy_check_mark: | -| Healthy Lives | Young People's Education, Employment and Training | 2018 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | +| Healthy Lives | Young People's Education, Employment and Training | 2022-23 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage of young people in education, employment, and training | :heavy_check_mark: | | Healthy Lives | Hypertension | 2020 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Lives | Overweight and Obesity in Adults | :x: - only available for 2015 | :x: | :x: | :x: | :x: | | Healthy Lives | Cancer Screening | :x: | :x: | :x: | :x: - The data is at the Health and Social Care Trusts level | :x: | From e1844813b9259547daf90ab56108018b49115e29 Mon Sep 17 00:00:00 2001 From: CatReid Date: Thu, 14 Nov 2024 15:02:42 +0000 Subject: [PATCH 03/78] First draft completed - unemployment First draft completed - unemployment, styled and rendered. data.R and metadata updated. --- R/data.R | 20 +++++++++++++ data-raw/healthy-lives/unemployment.R | 40 ++++++++++++-------------- data/lives_unemployment.rda | Bin 0 -> 316 bytes man/lives_unemployment.Rd | 30 +++++++++++++++++++ metadata.md | 2 +- 5 files changed, 70 insertions(+), 22 deletions(-) create mode 100644 data/lives_unemployment.rda create mode 100644 man/lives_unemployment.Rd diff --git a/R/data.R b/R/data.R index 4475ebb..8827ce3 100644 --- a/R/data.R +++ b/R/data.R @@ -49,3 +49,23 @@ #' @source \url{https://data.nisra.gov.uk/} #' "lives_pupil_absence" + +#' Percentage of People Experiencing Unemployment (2023) +#' +#' A dataset containing statistics on the percentage of people experiencing +#' unemployment, claiming unemployed-related benefits. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{unemployment_percentage}{Percentage of people experiencing unemployment +#' and claiming unemployed-related benefits(Jobseeker’s Allowance plus +#' out-of-work Universal Credit claimants who were claiming principally +#' for the reason of being unemployed.)} +#' \item{year}{Year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +#' +"lives_unemployment" diff --git a/data-raw/healthy-lives/unemployment.R b/data-raw/healthy-lives/unemployment.R index 80e7713..d00472a 100644 --- a/data-raw/healthy-lives/unemployment.R +++ b/data-raw/healthy-lives/unemployment.R @@ -1,26 +1,24 @@ +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readODS) +library(geographr) -GET( - "https://www.ninis2.nisra.gov.uk/Download/Labour%20Market/Claimant%20Count%20Annual%20Averages%20-%20Experimental%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) +# ---- Get and clean data ---- +# Unemployment data +# Source: https://data.nisra.gov.uk/ +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/CCAALGD/CSV/1.0/" +unemployment_raw <- read_csv(url) -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "B4:D15" - ) - -unemployment <- - raw |> - as_tibble() |> +lives_unemployment <- unemployment_raw |> + filter( + UNIT == "%", + Year == "2023" + ) |> select( - lad_code = `LGD2014 Code`, - unemployment_rate = `Claimant Count Annual Averages (%)` - ) + ltla24_code = LGD2014, + unemployment_percentage = VALUE, + year = Year + ) |> + slice(-1) -# Save -write_rds(unemployment, "data/vulnerability/health-inequalities/northern-ireland/healthy-lives/unemployment.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(lives_unemployment, overwrite = TRUE) diff --git a/data/lives_unemployment.rda b/data/lives_unemployment.rda new file mode 100644 index 0000000000000000000000000000000000000000..c4bfba682b1419655c81fe0a123e60ca8298cb39 GIT binary patch literal 316 zcmV-C0mJ@6T4*^jL0KkKSz<`{9{>RRf8_uBSbzWlf8fLc5J11D-=IJM05pIG0s*iA z8juo63VJkZZANJZ)E<~opbt|crIAXbG;7uMJREk>UGQq?GL~jlb=}68FJ59lexI+fJIRvfO&* zcO1*Df|MbUDTb3k#Ax0hlZ1<{oKRSDVO(huk3)1Z4sn{V*(BY49?V&AEYGpb8`3@!HLKy_alymC O#oUoj6eJjuJ;%WM`;i_1 literal 0 HcmV?d00001 diff --git a/man/lives_unemployment.Rd b/man/lives_unemployment.Rd new file mode 100644 index 0000000..7c9d84c --- /dev/null +++ b/man/lives_unemployment.Rd @@ -0,0 +1,30 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{lives_unemployment} +\alias{lives_unemployment} +\title{Percentage of People Experiencing Unemployment (2023)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{unemployment_percentage}{Percentage of people experiencing unemployment +and claiming unemployed-related benefits(Jobseeker’s Allowance plus +out-of-work Universal Credit claimants who were claiming principally +for the reason of being unemployed.)} +\item{year}{Year} + +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +lives_unemployment +} +\description{ +A dataset containing statistics on the percentage of people experiencing +unemployment, claiming unemployed-related benefits. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 96cb2fb..1683979 100644 --- a/metadata.md +++ b/metadata.md @@ -23,7 +23,7 @@ | Healthy Lives | Low Birth Weight | 2022-23 | [Public Health Agency](https://www.publichealth.hscni.net/publications/statistical-profile-childrens-health-northern-ireland-202223) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage of infants born with low birth weight (<2,500g) | :heavy_check_mark: | | Healthy Lives | Overweight and Obesity in Children | 2017/18-19/20 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Lives | Teenage Pregnancy | 2019 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: | :heavy_check_mark: | -| Healthy Lives | Unemployment | 2020 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: | :heavy_check_mark: | +| Healthy Lives | Unemployment | 2023 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage of people experiencing unemployment and claiming unemployment-related benefits | :heavy_check_mark: | | Healthy Lives | Job-related Training | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Lives | Low Pay | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Lives | Workplace Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | From 03289e77b2813fb775d7cbd13da1f8e9748eb399 Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 18 Nov 2024 09:35:52 +0000 Subject: [PATCH 04/78] First draft completed - overweight-obesity-children First draft completed - overweight-obesity-children, styled and rendered. data.R and metadata completed. --- R/data.R | 18 ++++++ .../overweight-obesity-children.R | 55 +++++++++--------- data/lives_childhood_overweight_obesity.rda | Bin 0 -> 335 bytes man/lives_childhood_overweight_obesity.Rd | 28 +++++++++ metadata.md | 2 +- 5 files changed, 73 insertions(+), 30 deletions(-) create mode 100644 data/lives_childhood_overweight_obesity.rda create mode 100644 man/lives_childhood_overweight_obesity.Rd diff --git a/R/data.R b/R/data.R index ebd8479..8ec6737 100644 --- a/R/data.R +++ b/R/data.R @@ -32,6 +32,24 @@ #' "lives_low_birth_weight" +#' Average percentage of Children Overweight/Obese (2022/23) +#' +#' A dataset containing statistics on the average percentage of children +#' clinically classed as overweight and obese in each Council, 2022/23. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{overweight_obesity_percentage}{Average percentage of children clinically +#' classed as overweight and obese in P1 and P6 (aged 4/5 and 10/11)} +#' \item{year}{School Year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +#' +"lives_childhood_overweight_obesity" + #' Percentage of Pupil Absences (2021/22) #' #' A dataset containing statistics on the percentage of unauthorised school diff --git a/data-raw/healthy-lives/overweight-obesity-children.R b/data-raw/healthy-lives/overweight-obesity-children.R index e68800c..1959f49 100644 --- a/data-raw/healthy-lives/overweight-obesity-children.R +++ b/data-raw/healthy-lives/overweight-obesity-children.R @@ -1,36 +1,33 @@ +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readODS) -GET( - "https://www.ninis2.nisra.gov.uk/Download/Health%20and%20Social%20Care/Childhood%20BMI%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) +# ---- Get and clean data ---- +# Childhood Overweight Obesity +# Source: https://data.nisra.gov.uk/ -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "B4:H15" - ) +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/CHILDBMILGD/CSV/1.0/" +childhood_overweight_obesity_raw <- read_csv(url) -obesity <- - raw |> - as_tibble() |> - select( - lad_code = `LGD2014 Code`, - rate_primary_1 = `% Overweight or Obese (Primary 1): All`, - rate_year_8 = `% Overweight or Obese (Year 8): All` - ) |> - rowwise() |> - mutate( - overweight_obese_children_rate = mean( - c(rate_primary_1, rate_year_8), - na.rm = TRUE - ) +lives_childhood_overweight_obesity <- childhood_overweight_obesity_raw |> + filter( + SEX == "All", + `Academic Year` == "2022/23", + `Statistic Label` %in% + c( + "Proportion of P1 children who are overweight or obese", + "Proportion of Y8 children who are overweight or obese" + ) ) |> + group_by(LGD2014) |> + mutate(overweight_obesity_percentage = mean(VALUE, na.rm = TRUE)) |> + distinct(LGD2014, .keep_all = TRUE) |> ungroup() |> - select(lad_code, overweight_obese_children_rate) + select( + ltla24_code = LGD2014, + overweight_obesity_percentage, + year = `Academic Year` + ) |> + slice(-12) -# Save -write_rds(obesity, "data/vulnerability/health-inequalities/northern-ireland/healthy-lives/overweight-obesity-children.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(lives_childhood_overweight_obesity, overwrite = TRUE) diff --git a/data/lives_childhood_overweight_obesity.rda b/data/lives_childhood_overweight_obesity.rda new file mode 100644 index 0000000000000000000000000000000000000000..9e8fd418cc50851fb64d2f24b02857699fafea99 GIT binary patch literal 335 zcmV-V0kHl;T4*^jL0KkKS+1K^1ONdqf5iX0NCFW7|KLOg5J11@-Jn1K00s&HumKEg z2}FsFQ*9=rOf*IyVq^v~ntE)g8WN2fVj47JXwxG>pwWm841y^TrcXk8hK7Sdqb5LT z4Gc{E(-=fwbu^T9C?YVWmE}>=MsJ1(B3@9nVWXTv3!dF&s)Xgq*DE_I#oOJFCC{6; zr(j`)dVmN)u)C^kpeBb66O>AjkuoZYz##eW$x7h7dg`T1_Ye*>Ca0p5S!{~wQ@u+{ zc`02ARlo`=)q8TvKxSqEnXW_-W>tC6CWH=&@~t5dl3uOb)bh=YiFNcnBa-4mOFou2 zD{`_?G+jJj hkF=y!pu|_3Wrz?t@B8@vV50wvxgwk>NLNj&f&iqDlzIRF literal 0 HcmV?d00001 diff --git a/man/lives_childhood_overweight_obesity.Rd b/man/lives_childhood_overweight_obesity.Rd new file mode 100644 index 0000000..4d27e0c --- /dev/null +++ b/man/lives_childhood_overweight_obesity.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{lives_childhood_overweight_obesity} +\alias{lives_childhood_overweight_obesity} +\title{Average percentage of Children Overweight/Obese (2022/23)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{overweight_obesity_percentage}{Average percentage of children clinically +classed as overweight and obese in P1 and P6 (aged 4/5 and 10/11)} +\item{year}{School Year} + +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +lives_childhood_overweight_obesity +} +\description{ +A dataset containing statistics on the average percentage of children +clinically classed as overweight and obese in each Council, 2022/23. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 170e714..7149716 100644 --- a/metadata.md +++ b/metadata.md @@ -21,7 +21,7 @@ | Healthy Lives | Children in State Care | :x: | :x: | :x: | :x: - The data is at the Health and Social Care Trusts level | :x: | | Healthy Lives | Infant Mortality | 2017-2019 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Lives | Low Birth Weight | 2022-23 | [Public Health Agency](https://www.publichealth.hscni.net/publications/statistical-profile-childrens-health-northern-ireland-202223) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage of infants born with low birth weight (<2,500g) | :heavy_check_mark: | -| Healthy Lives | Overweight and Obesity in Children | 2017/18-19/20 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: | :heavy_check_mark: | +| Healthy Lives | Overweight and Obesity in Children | 2022/23 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Average percentage of children classed as overweight and obese (P1 and P6, aged 4/5 and 10/11) | :heavy_check_mark: | | Healthy Lives | Teenage Pregnancy | 2020-22 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Rate of teenage pregnancies per 1,000 | :heavy_check_mark: | | Healthy Lives | Unemployment | 2020 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Lives | Job-related Training | :x: | :x: | :x: | :x: - data unavailable | :x: | From 7c0be4ac8c158aa1e97cf6a91027c9798783cb0e Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 18 Nov 2024 15:38:27 +0000 Subject: [PATCH 05/78] First draft completed - child-poverty First draft completed - child-poverty, styled and rendered. data.R and metadata updated --- R/data.R | 19 ++++++++++++++ data-raw/healthy-lives/child-poverty.R | 33 +++++++++++-------------- data/lives_child_poverty.rda | Bin 0 -> 324 bytes man/lives_child_poverty.Rd | 29 ++++++++++++++++++++++ metadata.md | 2 +- 5 files changed, 63 insertions(+), 20 deletions(-) create mode 100644 data/lives_child_poverty.rda create mode 100644 man/lives_child_poverty.Rd diff --git a/R/data.R b/R/data.R index ebd8479..df9afd3 100644 --- a/R/data.R +++ b/R/data.R @@ -1,3 +1,22 @@ +#' Percentage of Absolute Child Poverty (2017) +#' +#' A dataset containing statistics on the percentage of children (aged 15 and +#' under) living in absolute low income families in each Council, 2017. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{child_poverty_percentage}{Percentage of children 15 and under living in +#' absolute low incomes families (where a household's income is below 60% of +#' the median income in 2010/11, adjusted for inflation).} +#' \item{year}{Year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +#' +"lives_child_poverty" + #' Percentage GSCE Attainment, including Maths and English (2022/23) #' #' A dataset containing statistics on the percentage of GSCE attainment, diff --git a/data-raw/healthy-lives/child-poverty.R b/data-raw/healthy-lives/child-poverty.R index d6faa1d..4c08396 100644 --- a/data-raw/healthy-lives/child-poverty.R +++ b/data-raw/healthy-lives/child-poverty.R @@ -1,26 +1,21 @@ +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readODS) -GET( - "https://www.ninis2.nisra.gov.uk/Download/Making%20Life%20Better/Northern%20Ireland%20Multiple%20Deprivation%20Measure%202017%20-%20Indicators%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) +# ---- Get and clean data ---- +# Child Poverty Data +# Source: https://data.nisra.gov.uk/ -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "A4:AM15" - ) +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/NIMDM17T10/CSV/1.0/" +child_poverty_raw <- read_csv(url) -child_poverty <- - raw |> - as_tibble() |> +lives_child_poverty <- child_poverty_raw |> + filter(`Statistic Label` == + "Proportion of the population aged 15 and under living in households whose equivalised income is below 60 per cent of the NI median") |> select( - lad_code = `LGD2014 Code`, - child_poverty_percent = `Proportion of the population aged 15 and under living in households whose equivalised income is below 60 per cent of the NI median\n(%)` + ltla24_code = LGD2014, + child_poverty_percentage = VALUE, + year = `Ad-hoc year` ) -# Save -write_rds(child_poverty, "data/vulnerability/health-inequalities/northern-ireland/healthy-lives/child-poverty.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(lives_child_poverty, overwrite = TRUE) diff --git a/data/lives_child_poverty.rda b/data/lives_child_poverty.rda new file mode 100644 index 0000000000000000000000000000000000000000..f737aee160a4e90fd1b113c5f78ca8e177fca7df GIT binary patch literal 324 zcmV-K0lWS}T4*^jL0KkKS>>DRQ~&__f9?M}NI(Ds|KLOg5J11@-JnDO05FIE00sd7 z0s*iA8nz)NASCpjqfaPk^&TYJPf*YvNr>4nplC^=4WtZ)Kmari15AJcl4(s3QKzT? z8UO$Q00W>Rsx$=zIVHW}VR8@xyfb|`SRiQ2_p6C9kRR4#y`%|z#j*UV=asUX^J%oiA)xW}7VE_fPA-ISt zy#U%%N+uNX0qw>uW`>3gGNfVMc@R1=wuDzL2^4x&OS5?HE^U!W~ zAco7Y9vJShSe09Elm+KS=UbQ-X~?-V$oyoP)A2o_ie?TH)pT$Ykuo!7IHYYB6>B~c WC*HB!S@{8j{x0N-aG@c~H`J(6Y=#v8 literal 0 HcmV?d00001 diff --git a/man/lives_child_poverty.Rd b/man/lives_child_poverty.Rd new file mode 100644 index 0000000..6796728 --- /dev/null +++ b/man/lives_child_poverty.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{lives_child_poverty} +\alias{lives_child_poverty} +\title{Percentage of Absolute Child Poverty (2017)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{child_poverty_percentage}{Percentage of children 15 and under living in +absolute low incomes families (where a household's income is below 60\% of +the median income in 2010/11, adjusted for inflation).} +\item{year}{Year} + +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +lives_child_poverty +} +\description{ +A dataset containing statistics on the percentage of children (aged 15 and +under) living in absolute low income families in each Council, 2017. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index e613236..a645f0b 100644 --- a/metadata.md +++ b/metadata.md @@ -17,7 +17,7 @@ | Healthy Lives | Cancer Screening | :x: | :x: | :x: | :x: - The data is at the Health and Social Care Trusts level | :x: | | Healthy Lives | Sexual Health | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Lives | Vaccination Coverage | :x: | :x: | :x: | :x: - The data is at the Health and Social Care Trusts level | :x: | -| Healthy Lives | Child Poverty | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | +| Healthy Lives | Child Poverty | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Percentage of children (aged 15 and under) living in absolute low income families | :heavy_check_mark: | | Healthy Lives | Children in State Care | :x: | :x: | :x: | :x: - The data is at the Health and Social Care Trusts level | :x: | | Healthy Lives | Infant Mortality | 2018-2022 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only present at HSC level| :x: | | Healthy Lives | Low Birth Weight | 2022-23 | [Public Health Agency](https://www.publichealth.hscni.net/publications/statistical-profile-childrens-health-northern-ireland-202223) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage of infants born with low birth weight (<2,500g) | :heavy_check_mark: | From 770963998558233e1d3fde2499e9c9b353972d90 Mon Sep 17 00:00:00 2001 From: CatReid Date: Thu, 21 Nov 2024 11:37:00 +0000 Subject: [PATCH 06/78] First draft completed - self-harm First draft completed - self-harm, styled and rendered. data.R and metadata completed. --- R/data.R | 23 +++++++++++++++++ data-raw/healthy-people/self-harm.R | 37 ++++++++++++++-------------- data/people_self_harm.rda | Bin 0 -> 313 bytes man/people_self_harm.Rd | 34 +++++++++++++++++++++++++ metadata.md | 2 +- 5 files changed, 76 insertions(+), 20 deletions(-) create mode 100644 data/people_self_harm.rda create mode 100644 man/people_self_harm.Rd diff --git a/R/data.R b/R/data.R index ebd8479..c96a4cf 100644 --- a/R/data.R +++ b/R/data.R @@ -66,3 +66,26 @@ #' @source \url{https://data.nisra.gov.uk/} #' "lives_teenage_pregnancy" + +#' Rate of Self-Harm Related Admissions per 100,000 (2018/19-2022/23) +#' +#' A dataset containing statistics on the rate of self-harm related admissions +#' per 100k, per Council (2018/19-2022/23). +#' +#' To note: England's Health Index collects rate of self-harm admissions per +#' 100k in single-year increments. Only data available for Northern Ireland looks +#' at 5-year aggregates across financial years. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{self_harm_per_100k}{Rate of self-harm related admissions per 100k, +#' standardised by age and sex with respect to the European Standard Population +#' 2013} +#' \item{year}{Grouped financial year aggregrate, 5 year period} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +#' +"people_self_harm" diff --git a/data-raw/healthy-people/self-harm.R b/data-raw/healthy-people/self-harm.R index c7c8f3c..51f9976 100644 --- a/data-raw/healthy-people/self-harm.R +++ b/data-raw/healthy-people/self-harm.R @@ -1,25 +1,24 @@ +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readODS) -GET( - "https://www.ninis2.nisra.gov.uk/Download/Health%20and%20Social%20Care/Standardised%20Admission%20Rate%20for%20Self%20Harm%20Admissions%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) +# ---- Get data and clean ---- +# Self-Harm Emergency Admissions +# Source: https://data.nisra.gov.uk/ -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "B4:E15" - ) +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/SARSELFHARMLGD/CSV/1.0/" +self_harm_raw <- read_csv(url) -self_harm <- - raw |> - as_tibble() |> +people_self_harm <- self_harm_raw |> + filter( + SEX == "All", + `Grouped Financial Year` == "2018/19-2022/23" + ) |> select( - lad_code = `LGD2014 Code`, - self_harm_admissions_per_100000 = `Standardised Admission Rate` - ) + ltla24_code = LGD2014, + self_harm_per_100k = VALUE, + year = `Grouped Financial Year` + ) |> + slice(-12) -write_rds(self_harm, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/self-harm.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(people_self_harm, overwrite = TRUE) diff --git a/data/people_self_harm.rda b/data/people_self_harm.rda new file mode 100644 index 0000000000000000000000000000000000000000..287f126485e7393bc238fcbef19f2ebc8d4c2310 GIT binary patch literal 313 zcmV-90mlA9T4*^jL0KkKS&3M>@Bjg0|J46G*Z=?n|KLOcbU?pP+@L@JKmb4h0s*iA z8jC|k8YY=EGypWn@*_h)^n=uTfvQhQ`i&za8i2tJA*M!}G--`YB8dc^q57w&XaE2J z&;g+O&l%^8j}Cis1>jZ;b~2i^wooW*&(8FzCDLjB$83Q-V5~OI$3XxB{ALhTopLHF zDc!!So@0Ozi5VmVh7*_og#!{65P&2hDH8%I<&2_I3^kPW{M1tQGU%WeDKr$!rIfB7 zv0|B&vbhxRQ^iY^xk}r72@wH;kqTOnUvw4|A&teTh*kv#2Nk%jvnW$P)IPw51Tpaq zlU=;oSzPI;BoHDOoI!xlmK+c29F)w3)-Q~p<+Q=|QITf6D{d%yB|$k|;IG_)gZ?h$ Lig2MJ60vpQz?FsT literal 0 HcmV?d00001 diff --git a/man/people_self_harm.Rd b/man/people_self_harm.Rd new file mode 100644 index 0000000..4a28101 --- /dev/null +++ b/man/people_self_harm.Rd @@ -0,0 +1,34 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{people_self_harm} +\alias{people_self_harm} +\title{Rate of Self-Harm Related Admissions per 100,000 (2018/19-2022/23)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{self_harm_per_100k}{Rate of self-harm related admissions per 100k, +standardised by age and sex with respect to the European Standard Population +2013} +\item{year}{Grouped financial year aggregrate, 5 year period} + +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +people_self_harm +} +\description{ +A dataset containing statistics on the rate of self-harm related admissions +per 100k, per Council (2018/19-2022/23). +} +\details{ +To note: England's Health Index collects rate of self-harm admissions per +100k in single-year increments. Only data available for Northern Ireland looks +at 5-year aggregates across financial years. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index d95a14f..ea60cef 100644 --- a/metadata.md +++ b/metadata.md @@ -33,7 +33,7 @@ | Healthy People | Frailty | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy People | Children’s Social, Emotional and Mental Health | 2020 | [Youth Wellbeing Prevalence Survey](https://online.hscni.net/our-work/social-care-and-children/children-and-young-people/youth-wellbeing-prevalence-survey-2020/) | :x: | :x: (Raw) data unavailable and only at HSC level | :x: | | Healthy People | Depression | :x: | :x: | :x: | :x: - data unavailable | :x: | -| Healthy People | Self-harm | 2014/15-2018/19 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: | :heavy_check_mark: | +| Healthy People | Self-harm | 2018/19-2022/23 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Rate of self-harm related admissions per 100,000, standardised by age and sex. | :heavy_check_mark: | | Healthy People | Suicides | 2019 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: | :heavy_check_mark: | | Healthy People | Avoiable Deaths | 2015-19 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: | :heavy_check_mark: | | Healthy People | Healthy Life Expectancy | 2016-2018 | [ONS](https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/healthandlifeexpectancies/datasets/healthstatelifeexpectancyatbirthandatage65bylocalareasuk) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | From fc3ffda6894074bdea89be4da5950ba44bace7ae Mon Sep 17 00:00:00 2001 From: CatReid Date: Thu, 21 Nov 2024 14:46:04 +0000 Subject: [PATCH 07/78] First draft completed - mortality-all-causes First draft completed - mortality-all-causes, styled and rendered. data.R and metadata updated. --- R/data.R | 21 ++++++++++++ .../healthy-people/mortality-all-causes.R | 24 +++++++++++++ data/people_all_mortality.rda | Bin 0 -> 315 bytes man/people_all_mortality.Rd | 32 ++++++++++++++++++ metadata.md | 1 + 5 files changed, 78 insertions(+) create mode 100644 data-raw/healthy-people/mortality-all-causes.R create mode 100644 data/people_all_mortality.rda create mode 100644 man/people_all_mortality.Rd diff --git a/R/data.R b/R/data.R index ebd8479..c908ac4 100644 --- a/R/data.R +++ b/R/data.R @@ -66,3 +66,24 @@ #' @source \url{https://data.nisra.gov.uk/} #' "lives_teenage_pregnancy" + +#' Mortality all causes rate per 100k (2020-22) +#' +#' A dataset containing statistics from an age-sex standardised rate for all +#' causes of mortality per 100k, by Council (2020-22). +#' +#' To note: England's Health Index uses a single year to calculate mortality rates +#' from all causes. Northern Ireland only has 3-year aggregate data available. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{death_rate_per_100k}{age-sex standardised rate for all causes of +#' mortality per 100k} +#' \item{year}{3-year aggregated period} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +#' +"people_all_mortality" diff --git a/data-raw/healthy-people/mortality-all-causes.R b/data-raw/healthy-people/mortality-all-causes.R new file mode 100644 index 0000000..1a95ae2 --- /dev/null +++ b/data-raw/healthy-people/mortality-all-causes.R @@ -0,0 +1,24 @@ +# ---- Load packages ---- +library(tidyverse) + +# ---- Get data and clean +# Mortality from all causes +# Source: https://data.nisra.gov.uk/ + +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/SDRAAACMLGD/CSV/1.0/" +all_mortality_raw <- read_csv("https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/SDRAAACMLGD/CSV/1.0/") + +people_all_mortality <- all_mortality_raw |> + filter( + SEX == "All", + `Grouped Year` == "2020-22" + ) |> + slice(-12) |> + select( + ltla24_code = LGD2014, + death_rate_per_100k = VALUE, + year = `Grouped Year` + ) + +# ---- Save output to data/ folder ---- +usethis::use_data(people_all_mortality, overwrite = TRUE) diff --git a/data/people_all_mortality.rda b/data/people_all_mortality.rda new file mode 100644 index 0000000000000000000000000000000000000000..7f7c4363bc784aefb50334de6fada3744639cc36 GIT binary patch literal 315 zcmV-B0mS}7T4*^jL0KkKS<@I1!~g*`|Nj5GOh5nwf8ay`6hOak+@L@L@Blyn06;)M zKmY;(umI*Z8cC*;BSDDMMwtwN(<49ulL#WFX^;pE0st@*1Trx^pafDXZ8bF7fYU=J zgK7XULl6KjeS&&jp&sU?a4irG8v~98*+M`O95|P!%oI45yQ=~u7=-4o8IA}5I{0`h zpdkc$(qTQ1ZHshk`L@~E0rLP3kOBa9NLWG;kU&l)2!oqqNKPq(4V658cP6DOK&I-G znw|=3POV=kp-I(3nAFOpyB~385``cO(YKzpE2pnM9u7O?y*{TGXebbPAR+~bs%ive z)JkD`0fG1oj+74(lGGYb#IkuwnSA9%m6Vk?P@gj>6^e6)XjQ2shJqnc#X`T^!GXVv Nxgwk>NNJ1+;s9w)ckBQF literal 0 HcmV?d00001 diff --git a/man/people_all_mortality.Rd b/man/people_all_mortality.Rd new file mode 100644 index 0000000..4bdd604 --- /dev/null +++ b/man/people_all_mortality.Rd @@ -0,0 +1,32 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{people_all_mortality} +\alias{people_all_mortality} +\title{Mortality all causes rate per 100k (2020-22)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{death_rate_per_100k}{age-sex standardised rate for all causes of +mortality per 100k} +\item{year}{3-year aggregated period} + +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +people_all_mortality +} +\description{ +A dataset containing statistics from an age-sex standardised rate for all +causes of mortality per 100k, by Council (2020-22). +} +\details{ +To note: England's Health Index uses a single year to calculate mortality rates +from all causes. Northern Ireland only has 3-year aggregate data available. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index a9cda40..e4be875 100644 --- a/metadata.md +++ b/metadata.md @@ -36,6 +36,7 @@ | Healthy People | Self-harm | 2014/15-2018/19 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: | :heavy_check_mark: | | Healthy People | Suicides | 2019 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data unavailable - contact info@nisra.gov.uk and ask for Deaths by Cause (administrative geographies) | :x: | | Healthy People | Avoidable Deaths | 2015-19 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data unavailable - contact healthinequalities@health-ni.gov.uk and ask for Standardised Death Rate - Avoidable (administrative geographies) | :x: | +| Healthy People | Mortality from All Causes | 2020-22 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Age/sex-standardised all mortality rates per 100k | :heavy_check_mark: | | Healthy People | Healthy Life Expectancy | 2016-2018 | [ONS](https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/healthandlifeexpectancies/datasets/healthstatelifeexpectancyatbirthandatage65bylocalareasuk) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | | Healthy People | Anxiety | 2019-20 | [Annual Population Survey](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/1) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | | Healthy People | Happiness | 2019-20 | [Annual Population Survey](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/1) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | From c7958dad99ba67644c4b070e2a352e7625d398ba Mon Sep 17 00:00:00 2001 From: CatReid Date: Thu, 21 Nov 2024 16:57:55 +0000 Subject: [PATCH 08/78] First draft completed - anxiety First draft completed - anxiety, styled and rendered. data.R and metadata completed. --- R/data.R | 16 +++++++++++ data-raw/healthy-people/anxiety.R | 46 +++++++++++++----------------- data/people_anxiety.rda | Bin 0 -> 348 bytes man/people_anxiety.Rd | 27 ++++++++++++++++++ metadata.md | 2 +- 5 files changed, 64 insertions(+), 27 deletions(-) create mode 100644 data/people_anxiety.rda create mode 100644 man/people_anxiety.Rd diff --git a/R/data.R b/R/data.R index fca9b22..5c5f11d 100644 --- a/R/data.R +++ b/R/data.R @@ -67,6 +67,22 @@ #' "lives_teenage_pregnancy" +#' Average Measurement of Anxiety Out of 10 (2022-23) +#' +#' A dataset containing statistics of personal ratings on feelings of +#' anxiety out of 10, by Council (2022-23). +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{anxiety_score_out_of_10}{Average personal ratings on feelings of +#' anxiety out of 10 - 10 is most anxious, 1 is least anxious} +#' \item{year}{Time period} +#' ... +#' } +#' @source \url{https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4} +"people_anxiety" + #' Percentage of People Aged 15-64 with Long-Term Health Problem/Disability #' that Limits Daily Activities #' diff --git a/data-raw/healthy-people/anxiety.R b/data-raw/healthy-people/anxiety.R index 718b587..4b13a45 100644 --- a/data-raw/healthy-people/anxiety.R +++ b/data-raw/healthy-people/anxiety.R @@ -1,33 +1,27 @@ -# ---- Load ---- +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readxl) +library(rio) library(geographr) -library(sf) -source("R/utils.R") +# ---- Get and clean data ---- +# Anxiety +# Source: https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4 -# ---- Extract data ---- -# Source: https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/1 -GET( - "https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/1.xlsx", - write_disk(tf <- tempfile(fileext = ".xlsx")) -) +anxiety_raw <- import("https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/4.csv") -anxiety_raw <- - read_excel(tf, sheet = "Dataset", skip = 2) - -# The 'Average (mean)' estimate provides the score out of 0-10. The other estimates are -# thresholds (percentages) described in the QMI: https://www.ons.gov.uk/peoplepopulationandcommunity/wellbeing/methodologies/personalwellbeingintheukqmi -anxiety <- - anxiety_raw |> - filter(Estimate == "Average (mean)") |> - filter(MeasureOfWellbeing == "Anxiety") |> - select( - lad_code = `Geography code`, - anxiety_score_out_of_10 = `2019-20` +people_anxiety <- anxiety_raw |> + filter( + str_starts(`administrative-geography`, "N"), + MeasureOfWellbeing == "Anxiety", + `yyyy-yy` == "2022-23", + `wellbeing-estimate` == "average-mean" ) |> - filter_codes(lad_code, "^N") |> - filter(lad_code != "N92000002") + slice(-11) |> + select( + ltla24_code = `administrative-geography`, + anxiety_score_out_of_10 = `v4_3`, + year = `Time` + ) -write_rds(anxiety, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/anxiety.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(people_anxiety, overwrite = TRUE) diff --git a/data/people_anxiety.rda b/data/people_anxiety.rda new file mode 100644 index 0000000000000000000000000000000000000000..ffbc33adf1a600e963d4654bf121652c165b754d GIT binary patch literal 348 zcmV-i0i*sxT4*^jL0KkKSpa=QGynl2|NsB{Oo0Fcf8xZ!FhH*--uOZQ05A*z06+i+ z0DvG20s*iA7$9m-RC*?wG-;zlKmnit01XD3X`|FQX{JUa38n%V1k(t?F)|utXlMkH zO%h~mpz?sw8Z-?6G#NA=p!FJhM^d(JxuIg(LUL!paonazx-0dRQL@Kg<`@YJZgK)O z_gU`U-{8Gw@o1T}ZH2}X*%C~FSQrLDO;89EcfI__jfj{KGYm3A3?Ut#v_%F687XQ9 z`Xfm2r%2F16Qo9wfg%)m+8${VFQi#W>PXIlM3gMA6Cy;5^=f3w^Y3A=A?W?Axsoe6 z<;QKz5EfEJ4)X`tzrSgyw3rSc3`R(H^9X0+wQrd=NFAA^Qr%tkB}AyK^p#E& unu-(+iGzFZ(<3<22SXM}t-=Su>6T3hu#ufW+sGh+e;0B^I8cxPeM2-Sc8 Date: Mon, 25 Nov 2024 08:58:16 +0000 Subject: [PATCH 09/78] First draft completed - happiness First draft completed - happiness, styled and rendered. data.R and metadata updated. --- R/data.R | 16 +++++++++++++++ data-raw/healthy-people/happiness.R | 30 +++++++++++++++++++++++++++- data/people_happiness.rda | Bin 0 -> 334 bytes man/people_happiness.Rd | 27 +++++++++++++++++++++++++ metadata.md | 2 +- 5 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 data/people_happiness.rda create mode 100644 man/people_happiness.Rd diff --git a/R/data.R b/R/data.R index fca9b22..ab8e7ef 100644 --- a/R/data.R +++ b/R/data.R @@ -87,3 +87,19 @@ #' @source \url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} #' "people_disability_daily_activities" + +#' Average Measurement of Happiness Out of 10 (2022-23) +#' +#' A dataset containing statistics of personal ratings on feelings of +#' happiness out of 10, by Council (2022-23). +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{happiness_score_out_of_10}{Average personal ratings on feelings of +#' happiness out of 10 - 10 is most happy, 1 is least happy} +#' \item{year}{Time period} +#' ... +#' } +#' @source \url{https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4} +"people_happiness" diff --git a/data-raw/healthy-people/happiness.R b/data-raw/healthy-people/happiness.R index 2dc1861..024c16b 100644 --- a/data-raw/healthy-people/happiness.R +++ b/data-raw/healthy-people/happiness.R @@ -1,3 +1,31 @@ +# ---- Load packages ---- +library(tidyverse) +library(rio) + +# ---- Get and clean data ---- +# Happiness +# Source: https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4 + +happiness_raw <- import("https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/4.csv") + +people_happiness <- happiness_raw |> + filter( + str_starts(`administrative-geography`, "N"), + MeasureOfWellbeing == "Happiness", + `yyyy-yy` == "2022-23", + `wellbeing-estimate` == "average-mean" + ) |> + slice(-11) |> + select( + ltla24_code = `administrative-geography`, + happiness_score_out_of_10 = `v4_3`, + year = `Time` + ) + +# ---- Save output to data/ folder ---- +usethis::use_data(people_happiness, overwrite = TRUE) + + # ---- Load ---- library(tidyverse) library(httr) @@ -30,4 +58,4 @@ happiness <- filter_codes(lad_code, "^N") |> filter(lad_code != "N92000002") -write_rds(happiness, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/happiness.rds") \ No newline at end of file +write_rds(happiness, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/happiness.rds") diff --git a/data/people_happiness.rda b/data/people_happiness.rda new file mode 100644 index 0000000000000000000000000000000000000000..08c546de0ec82207de81497510c765a9d24a50a5 GIT binary patch literal 334 zcmV-U0kQr3Xkv(>>160h5F-Xnwwi<5#~C2&6cVZuAajYq5Gt*MgwWcFu3X!@ zdW*$lE-A?kI2TY>5OK%?5c`lxo+gA;3Lz5XL(&yY^Yl`j6DzY?~qxKyFU$Z}Y{2(YTY&cn<{= zdxe$SdF7CwPpTOR?3Y#%yqU{{i0_4$Y{qHU11t>>15Q0fs2PQnggzw7qkZyq7mSd* g0q~KT4*dyT2nY%q0D=xA#D9yqBAh5lLo?F%00ZKV1poj5 literal 0 HcmV?d00001 diff --git a/man/people_happiness.Rd b/man/people_happiness.Rd new file mode 100644 index 0000000..f07e589 --- /dev/null +++ b/man/people_happiness.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{people_happiness} +\alias{people_happiness} +\title{Average Measurement of Happiness Out of 10 (2022-23)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{happiness_score_out_of_10}{Average personal ratings on feelings of +happiness out of 10 - 10 is most happy, 1 is least happy} +\item{year}{Time period} +... +} +} +\source{ +\url{https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4} +} +\usage{ +people_happiness +} +\description{ +A dataset containing statistics of personal ratings on feelings of +happiness out of 10, by Council (2022-23). +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 2f2ead7..dff9f08 100644 --- a/metadata.md +++ b/metadata.md @@ -38,7 +38,7 @@ | Healthy People | Avoidable Deaths | 2015-19 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data unavailable - contact healthinequalities@health-ni.gov.uk and ask for Standardised Death Rate - Avoidable (administrative geographies) | :x: | | Healthy People | Healthy Life Expectancy | 2016-2018 | [ONS](https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/healthandlifeexpectancies/datasets/healthstatelifeexpectancyatbirthandatage65bylocalareasuk) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | | Healthy People | Anxiety | 2019-20 | [Annual Population Survey](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/1) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | -| Healthy People | Happiness | 2019-20 | [Annual Population Survey](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/1) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | +| Healthy People | Happiness | 2022-23 | [ONS](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Average personal ratings on feelings of happiness out of 10.| :heavy_check_mark: | | Healthy People | Life Satisfaction | 2019-20 | [Annual Population Survey](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/1) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | | Healthy People | Life Worthwhileness | 2019-20 | [Annual Population Survey](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/1) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | | Healthy People | Cancer | 2021 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: | :heavy_check_mark: | From bce4f0567fd3fe6b2137970e26bd764640e64199 Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 25 Nov 2024 09:17:35 +0000 Subject: [PATCH 10/78] First draft completed - life worthwhileness First draft completed - life worthwhileness, styled and rendered. data.R and metadata completed --- R/data.R | 16 ++++++ data-raw/healthy-people/life-worthwhileness.R | 47 ++++++++---------- data/people_life_worthwhileness.rda | Bin 0 -> 338 bytes man/people_life_worthwhileness.Rd | 27 ++++++++++ metadata.md | 2 +- 5 files changed, 64 insertions(+), 28 deletions(-) create mode 100644 data/people_life_worthwhileness.rda create mode 100644 man/people_life_worthwhileness.Rd diff --git a/R/data.R b/R/data.R index fca9b22..7a3da02 100644 --- a/R/data.R +++ b/R/data.R @@ -87,3 +87,19 @@ #' @source \url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} #' "people_disability_daily_activities" + +#' Average Measurement of Life Worthwhileness Out of 10 (2022-23) +#' +#' A dataset containing statistics of personal ratings on feelings of +#' life worthwhileness out of 10, by Council (2022-23). +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{worthwhile_score_out_of_10}{Average personal ratings on feelings of +#' life worthwhileness out of 10 - 10 is most worthwhile, 1 is least worthwhile} +#' \item{year}{Time period} +#' ... +#' } +#' @source \url{https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4} +"people_life_worthwhileness" diff --git a/data-raw/healthy-people/life-worthwhileness.R b/data-raw/healthy-people/life-worthwhileness.R index 92e6b6a..804ca86 100644 --- a/data-raw/healthy-people/life-worthwhileness.R +++ b/data-raw/healthy-people/life-worthwhileness.R @@ -1,33 +1,26 @@ -# ---- Load ---- +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readxl) -library(geographr) -library(sf) +library(rio) -source("R/utils.R") +# ---- Get and clean data ---- +# Life worthwhileness +# Source: https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4 -# ---- Extract data ---- -# Source: https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/1 -GET( - "https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/1.xlsx", - write_disk(tf <- tempfile(fileext = ".xlsx")) -) +life_worthwhileness_raw <- import("https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/4.csv") -life_worthwhileness_raw <- - read_excel(tf, sheet = "Dataset", skip = 2) - -# The 'Average (mean)' estimate provides the score out of 0-10. The other estimates are -# thresholds (percentages) described in the QMI: https://www.ons.gov.uk/peoplepopulationandcommunity/wellbeing/methodologies/personalwellbeingintheukqmi -life_worthwhileness <- - life_worthwhileness_raw |> - filter(Estimate == "Average (mean)") |> - filter(MeasureOfWellbeing == "Worthwhile") |> - select( - lad_code = `Geography code`, - life_worthwhileness_score_out_of_10 = `2019-20` +people_life_worthwhileness <- life_worthwhileness_raw |> + filter( + str_starts(`administrative-geography`, "N"), + MeasureOfWellbeing == "Worthwhile", + `yyyy-yy` == "2022-23", + `wellbeing-estimate` == "average-mean" ) |> - filter_codes(lad_code, "^N") |> - filter(lad_code != "N92000002") + slice(-11) |> + select( + ltla24_code = `administrative-geography`, + worthwhile_score_out_of_10 = `v4_3`, + year = `Time` + ) -write_rds(life_worthwhileness, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/life-worthwhileness.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(people_life_worthwhileness, overwrite = TRUE) diff --git a/data/people_life_worthwhileness.rda b/data/people_life_worthwhileness.rda new file mode 100644 index 0000000000000000000000000000000000000000..5536cd2f4159a794ca264fcb4bc7fd4b8ccf33f5 GIT binary patch literal 338 zcmV-Y0j>T*T4*^jL0KkKS*tHz{QvV0f8s<1Fhs9s-k?GNhyVyc5C#B% z00;vCumKh}gGDr%G5}}*13=IKGy$QLPf$W8nreEUh|!<`XaHyc&;Zla0E$S2^%(|? zfY1#wsiut@0000>U|b?hsSKe)ASDM24PpmFm@|FopcY5~*T?vnL_lmjP9~=GO6}eY z*XX`wnbBszYrwY!VFt1DAS8xt;V~#GM9_+u{_M=Va24R<_8?4@!&y#`T@yV3(o&+C z6rR^jf?5?+rAidWrFqn=Y!mGvQvpL-WVkOhL+31WkHVY_y9e8Kh>y$oQinrNcrz kS6fI(6kC8n;10zO^rU|M-IWPos6XQFNT&)C6=mz+pgM4mlmGw# literal 0 HcmV?d00001 diff --git a/man/people_life_worthwhileness.Rd b/man/people_life_worthwhileness.Rd new file mode 100644 index 0000000..a608276 --- /dev/null +++ b/man/people_life_worthwhileness.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{people_life_worthwhileness} +\alias{people_life_worthwhileness} +\title{Average Measurement of Life Worthwhileness Out of 10 (2022-23)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{worthwhile_score_out_of_10}{Average personal ratings on feelings of +life worthwhileness out of 10 - 10 is most worthwhile, 1 is least worthwhile} +\item{year}{Time period} +... +} +} +\source{ +\url{https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4} +} +\usage{ +people_life_worthwhileness +} +\description{ +A dataset containing statistics of personal ratings on feelings of +life worthwhileness out of 10, by Council (2022-23). +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 2f2ead7..de3a403 100644 --- a/metadata.md +++ b/metadata.md @@ -40,7 +40,7 @@ | Healthy People | Anxiety | 2019-20 | [Annual Population Survey](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/1) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | | Healthy People | Happiness | 2019-20 | [Annual Population Survey](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/1) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | | Healthy People | Life Satisfaction | 2019-20 | [Annual Population Survey](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/1) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | -| Healthy People | Life Worthwhileness | 2019-20 | [Annual Population Survey](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/1) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | +| Healthy People | Life Worthwhileness | 2022-23 | [ONS](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Average personal ratings on feelings of life worthwhileness out of 10. | :heavy_check_mark: | | Healthy People | Cancer | 2021 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: | :heavy_check_mark: | | Healthy People | Cardiovascular Conditions: Atrial Fibrillation | 2021 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :x: This indicator not overtly present in or acting as a substitute for a similar indicator in England's Health Index. To check at the end.| :x: | | Healthy People | Cardiovascular Conditions: CHD | 2021 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :x: This indicator not overtly present in or acting as a substitute for a similar indicator in England's Health Index. To check at the end.| :x: | From b364c5ef85143b168c36a811ff8020e0e96afe7d Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 25 Nov 2024 09:41:45 +0000 Subject: [PATCH 11/78] First draft completed - life-satisfaction First draft completed - life-satisfaction, styled and rendered. data.R and metadata completed. --- R/data.R | 16 +++++++ data-raw/healthy-people/life-satisfaction.R | 47 +++++++++----------- data/people_life_satisfaction.rda | Bin 0 -> 338 bytes man/people_life_satisfaction.Rd | 27 +++++++++++ metadata.md | 2 +- 5 files changed, 64 insertions(+), 28 deletions(-) create mode 100644 data/people_life_satisfaction.rda create mode 100644 man/people_life_satisfaction.Rd diff --git a/R/data.R b/R/data.R index fca9b22..de8239a 100644 --- a/R/data.R +++ b/R/data.R @@ -87,3 +87,19 @@ #' @source \url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} #' "people_disability_daily_activities" + +#' Average Measurement of Life Satisfaction Out of 10 (2022-23) +#' +#' A dataset containing statistics of personal ratings on feelings of +#' life satisfaction out of 10, by Council (2022-23). +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{satisfaction_score_out_of_10}{Average personal ratings on feelings of +#' life satisfaction out of 10 - 10 is most satisfied, 1 is least satisfied} +#' \item{year}{Time period} +#' ... +#' } +#' @source \url{https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4} +"people_life_satisfaction" diff --git a/data-raw/healthy-people/life-satisfaction.R b/data-raw/healthy-people/life-satisfaction.R index 1a60199..6762063 100644 --- a/data-raw/healthy-people/life-satisfaction.R +++ b/data-raw/healthy-people/life-satisfaction.R @@ -1,33 +1,26 @@ -# ---- Load ---- +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readxl) -library(geographr) -library(sf) +library(rio) -source("R/utils.R") +# ---- Get and clean data ---- +# Life Satisfaction +# Source: https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4 -# ---- Extract data ---- -# Source: https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/1 -GET( - "https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/1.xlsx", - write_disk(tf <- tempfile(fileext = ".xlsx")) -) +life_satisfaction_raw <- import("https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/4.csv") -life_satisfaction_raw <- - read_excel(tf, sheet = "Dataset", skip = 2) - -# The 'Average (mean)' estimate provides the score out of 0-10. The other estimates are -# thresholds (percentages) described in the QMI: https://www.ons.gov.uk/peoplepopulationandcommunity/wellbeing/methodologies/personalwellbeingintheukqmi -life_satisfaction <- - life_satisfaction_raw |> - filter(Estimate == "Average (mean)") |> - filter(MeasureOfWellbeing == "Life Satisfaction") |> - select( - lad_code = `Geography code`, - life_satisfaction_score_out_of_10 = `2019-20` +people_life_satisfaction <- life_satisfaction_raw |> + filter( + str_starts(`administrative-geography`, "N"), + MeasureOfWellbeing == "Life satisfaction", + `yyyy-yy` == "2022-23", + `wellbeing-estimate` == "average-mean" ) |> - filter_codes(lad_code, "^N") |> - filter(lad_code != "N92000002") + slice(-11) |> + select( + ltla24_code = `administrative-geography`, + satisfaction_score_out_of_10 = `v4_3`, + year = `Time` + ) -write_rds(life_satisfaction, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/life-satisfaction.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(people_life_satisfaction, overwrite = TRUE) diff --git a/data/people_life_satisfaction.rda b/data/people_life_satisfaction.rda new file mode 100644 index 0000000000000000000000000000000000000000..3ff0fa6bd8f211c5b2026cfc1dd280d05b3d324a GIT binary patch literal 338 zcmV-Y0j>T*T4*^jL0KkKS?cfi5&!`tf8YMQOh>?Df8s=eFhs8>-nc>lhyegV5C#B% zAPfTmumKh}gGCyFpbZ9q02%-QGypVY^#e*8nW^e}nq&X~0009(0BN8CDI%IOG#;Ud zGyu`+10cu%009wVf}#wTUmYYsl??#8aQkEXqJL6v9&a zljihSB}GLyl&Ys9nA53H8IVB`zLq9Cry~;Uw>ht+e26+&BQ)UZ&Bn}QQ^UcH0pYsl z8tW@aGV81!0(`u Date: Mon, 25 Nov 2024 15:45:57 +0000 Subject: [PATCH 12/78] First draft completed - mental-health-conditions First draft completed - mental-health-conditions, styled and rendered. data.R and metadata completed. --- R/data.R | 19 ++++++++ .../healthy-people/mental-health-conditions.R | 43 ++++++++++++++++++ data/people_mental_health.rda | Bin 0 -> 380 bytes man/people_mental_health.Rd | 30 ++++++++++++ metadata.md | 2 +- 5 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 data-raw/healthy-people/mental-health-conditions.R create mode 100644 data/people_mental_health.rda create mode 100644 man/people_mental_health.Rd diff --git a/R/data.R b/R/data.R index fca9b22..9fb0843 100644 --- a/R/data.R +++ b/R/data.R @@ -87,3 +87,22 @@ #' @source \url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} #' "people_disability_daily_activities" + +#' Adult Population Percentage with an Emotional, Psychological, or Mental Health +#' Condition (2021) +#' +#' A dataset containing statistics on the percentage of adults (aged 15+) with +#' an emotional, psychological, or mental health condition, by Council (2021). +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{mental_health_percentage}{Percentage of adult population (aged 15+) +#' describing themselves as having an emotional, psychological, or mental health +#' condition} +#' \item{year}{Year} +#' +#' ... +#' } +#' @source \url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} +"people_mental_health" diff --git a/data-raw/healthy-people/mental-health-conditions.R b/data-raw/healthy-people/mental-health-conditions.R new file mode 100644 index 0000000..189a5cb --- /dev/null +++ b/data-raw/healthy-people/mental-health-conditions.R @@ -0,0 +1,43 @@ +# ---- Load packages ---- +library(tidyverse) +library(httr) +library(readxl) + +# ---- Get and clean data ---- +# Mental health conditions +# Source: https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables + +tf <- tempfile(fileext = ".xlsx") +download.file("https://www.nisra.gov.uk/system/files/statistics/census-2021-ms-d12.xlsx", tf, mode = "wb") + +mental_health_raw <- read_excel(tf, sheet = 2, skip = 8) + +people_mental_health <- mental_health_raw |> + slice(2:12) |> + mutate(across(3:17, as.numeric)) |> + rowwise() |> + mutate( + mental_health_total = sum( + `Usual residents aged 15-39 years:\r\n Has an emotional, psychological or mental health condition`, + `Usual residents aged 40-64 years:\r\n Has an emotional, psychological or mental health condition`, + `Usual residents aged 65+ years:\r\n Has an emotional, psychological or mental health condition` + ), + population_total = sum( + `Usual residents aged 15-39 years`, + `Usual residents aged 40-64 years`, + `Usual residents aged 65+ years` + ) + ) |> + ungroup() |> + mutate( + mental_health_percentage = (mental_health_total / population_total) * 100, + year = "2021" + ) |> + select( + ltla24_code = `Geography code`, + mental_health_percentage, + year + ) + +# ---- Save output to data/ folder ---- +usethis::use_data(people_mental_health, overwrite = TRUE) diff --git a/data/people_mental_health.rda b/data/people_mental_health.rda new file mode 100644 index 0000000000000000000000000000000000000000..ba9bdfca9620437d8b21f4e16f603de8d46d7440 GIT binary patch literal 380 zcmV-?0fYWRT4*^jL0KkKSzKCZoB#nA|KI<6PQZSdf8bmp5MaOO-KtH3KuCl@1OlUs zvkC%*umKoa5RitWOiV*GCYofzXkea0NMz7$0T=;23ERrO9AvuY1e`|dw~TMefYSYfVk9tYH{3gK z0WEikwy(1xrA9=YOk8YyjG9vFOmuTXdnBj;41rA9V{rN ze7=p>W94Y7%r05(HFkL@PCyr_7D*KnAaX^-XM?S0BtnrC1EL5TA{Ciw*>9)2B=%8u ztE=DWh=M8Je^P+Zot)AMpq5ZD?1KT<(4gY4oY^X30s9LBz(8NkdHY0N;7Y@v02m@6 z5QFg})KGImKu;nb$Dn#{dr5qU1abHL>l5~Jq{l@&is{$CTE$!Fifvzl>oGXWEi}nr a{3Zn|>Naa_=L3M8Mck226eJfGnkN9oqn|1O literal 0 HcmV?d00001 diff --git a/man/people_mental_health.Rd b/man/people_mental_health.Rd new file mode 100644 index 0000000..fbc0630 --- /dev/null +++ b/man/people_mental_health.Rd @@ -0,0 +1,30 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{people_mental_health} +\alias{people_mental_health} +\title{Adult Population Percentage with an Emotional, Psychological, or Mental Health +Condition (2021)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{mental_health_percentage}{Percentage of adult population (aged 15+) +describing themselves as having an emotional, psychological, or mental health +condition} +\item{year}{Year} + +... +} +} +\source{ +\url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} +} +\usage{ +people_mental_health +} +\description{ +A dataset containing statistics on the percentage of adults (aged 15+) with +an emotional, psychological, or mental health condition, by Council (2021). +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 4dd7880..8b7a16d 100644 --- a/metadata.md +++ b/metadata.md @@ -32,7 +32,7 @@ | Healthy People | Disability Impacting Daily Activities | 2021 | [NISRA](https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables) | [OGL](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage of people aged 15-64 with long-Term health problem/disability that limits daily activities by a lot or by a little | :heavy_check_mark: | | Healthy People | Frailty | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy People | Children’s Social, Emotional and Mental Health | 2020 | [Youth Wellbeing Prevalence Survey](https://online.hscni.net/our-work/social-care-and-children/children-and-young-people/youth-wellbeing-prevalence-survey-2020/) | :x: | :x: (Raw) data unavailable and only at HSC level | :x: | -| Healthy People | Depression | :x: | :x: | :x: | :x: - data unavailable | :x: | +| Healthy People | Mental Health Condition | 2021 | [Census](https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage of adult population (aged 15+) with an emotional, psychological, or mental health condition | :heavy_check_mark: | | Healthy People | Self-harm | 2014/15-2018/19 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: | :heavy_check_mark: | | Healthy People | Suicides | 2019 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data unavailable - contact info@nisra.gov.uk and ask for Deaths by Cause (administrative geographies) | :x: | | Healthy People | Avoidable Deaths | 2015-19 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data unavailable - contact healthinequalities@health-ni.gov.uk and ask for Standardised Death Rate - Avoidable (administrative geographies) | :x: | From 87be4817dc9e7031be59e34951f0d1809fc5910d Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 27 Nov 2024 13:03:31 +0000 Subject: [PATCH 13/78] Updated metadata - housing affordability Updated metadata - housing affordability. Indicator not overtly present in England's Health Index. To review at the end. --- metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.md b/metadata.md index 2afbc8f..9222cfd 100644 --- a/metadata.md +++ b/metadata.md @@ -57,7 +57,7 @@ | Healthy Places | Private Outdoor Space | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Places | Public Green Space | :x: | :x: | :x: | :heavy_exclamation_mark: Indicator not overtly present in England's Health Index. To review at the end. | :x: | | Healthy Places | Household Overcrowding | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index.| :x: | -| Healthy Places | Housing Affordability | :x: | :x: | :x: | :x: - data unavailable | :x: | +| Healthy Places | Housing Affordability | :x: | :x: | :x: | :heavy_exclamation_mark: Indicator not overtly present in England's Health Index. To review at the end. | :x: | | Healthy Places | Rough Sleeping | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Distance to GP Services | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Distance to Pharmacies | :x: | :x: | :x: | :x: - data unavailable | :x: | From 3e3142a6b1553ee1e65c89a53db7f0d1a519354d Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 27 Nov 2024 14:16:05 +0000 Subject: [PATCH 14/78] Updated metadata - rough sleeping Updated metadata - rough sleeping. Data unavailable. --- metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.md b/metadata.md index 9222cfd..c6393ec 100644 --- a/metadata.md +++ b/metadata.md @@ -58,7 +58,7 @@ | Healthy Places | Public Green Space | :x: | :x: | :x: | :heavy_exclamation_mark: Indicator not overtly present in England's Health Index. To review at the end. | :x: | | Healthy Places | Household Overcrowding | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index.| :x: | | Healthy Places | Housing Affordability | :x: | :x: | :x: | :heavy_exclamation_mark: Indicator not overtly present in England's Health Index. To review at the end. | :x: | -| Healthy Places | Rough Sleeping | :x: | :x: | :x: | :x: - data unavailable | :x: | +| Healthy Places | Rough Sleeping | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Places | Distance to GP Services | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Distance to Pharmacies | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Distance to Sports or Leisure Facilities | :x: | :x: | :x: | :x: - data unavailable | :x: | From 81db5173d134510c566c542c8dbe18d35bf3ab52 Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 27 Nov 2024 15:13:57 +0000 Subject: [PATCH 15/78] First draft completed - personal-crime First draft completed - personal-crime, styled and rendered. data.R and metadata completed. --- R/data.R | 18 ++++++++ data-raw/healthy-places/personal-crimes.R | 51 ++++++++++------------ data/places_personal_crime.rda | Bin 0 -> 327 bytes man/places_personal_crime.Rd | 28 ++++++++++++ metadata.md | 2 +- 5 files changed, 70 insertions(+), 29 deletions(-) create mode 100644 data/places_personal_crime.rda create mode 100644 man/places_personal_crime.Rd diff --git a/R/data.R b/R/data.R index fca9b22..da09fc9 100644 --- a/R/data.R +++ b/R/data.R @@ -87,3 +87,21 @@ #' @source \url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} #' "people_disability_daily_activities" + +#' Rates of Personal Crime per 1,000 (2017) +#' +#' A dataset containing statistics on 'personal crime' per 1,000 people in +#' Northern Irish Council Areas. 'Personal crime' is defined as violence against +#' the person, sexual offences, robbery, theft, criminal damage, and arson. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{personal_crime_per_1k}{Number of personal crimes per 1,000 people} +#' \item{year}{Year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +#' +"places_personal_crime" diff --git a/data-raw/healthy-places/personal-crimes.R b/data-raw/healthy-places/personal-crimes.R index c0ca917..cdd4d69 100644 --- a/data-raw/healthy-places/personal-crimes.R +++ b/data-raw/healthy-places/personal-crimes.R @@ -1,34 +1,29 @@ +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readODS) -GET( - "https://www.ninis2.nisra.gov.uk/Download/Deprivation/Northern%20Ireland%20Multiple%20Deprivation%20Measure%202017%20-%20Indicators%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) +# ---- Get and clean data ---- +# Personal Crime +# Source: https://data.nisra.gov.uk/ -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "B4:AM15" - ) +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/NIMDM17T10/CSV/1.0/" +personal_crime_raw <- read_csv(url) -crime <- - raw |> - as_tibble() |> - select( - lad_code = `LGD2014 Code`, - `Rate of Violence (including sexual offences), robbery and public order\n(per 1,000 population)`, - `Rate of Burglary\n(per 1,000 population)`, - `Rate of Theft\n(per 1,000 population)`, - `Rate of Criminal Damage and Arson\n(per 1,000 population)` - ) |> - rowwise() |> - mutate( - personal_crime_per_1000 = sum(c_across(!lad_code)) - ) |> +places_personal_crime <- personal_crime_raw |> + filter(`Statistic Label` %in% c( + "Rate of Violence (including sexual offences), robbery and public order (per 1,000 population)", + "Rate of Burglary (per 1,000 population)", + "Rate of Theft (per 1,000 population)", + "Rate of Criminal Damage and Arson (per 1,000 population)" + )) |> + group_by(LGD2014) |> + mutate(personal_crime_per_1k = sum(VALUE, na.rm = TRUE)) |> ungroup() |> - select(lad_code, personal_crime_per_1000) + distinct(LGD2014, .keep_all = TRUE) |> + select( + ltla24_code = LGD2014, + personal_crime_per_1k, + year = `Ad-hoc year` + ) -write_rds(crime, "data/vulnerability/health-inequalities/northern-ireland/healthy-places/personal-crime.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(places_personal_crime, overwrite = TRUE) diff --git a/data/places_personal_crime.rda b/data/places_personal_crime.rda new file mode 100644 index 0000000000000000000000000000000000000000..faa4735c2605c8253b18b47de6de3ccd13fbd12c GIT binary patch literal 327 zcmV-N0l5A`T4*^jL0KkKS+C%8+5iCa|Kkb8B(O<$+7G4TMa# z)d9D2ItTpMu41chjJ+(BJM>|A-oFgwm&(ZJnj<4rY$G8%zVUE)^t~g{PtoDm(2<}) ZW9@t29_Yc}%@{ZMyOJrwgoS?tp3sUYm5=}c literal 0 HcmV?d00001 diff --git a/man/places_personal_crime.Rd b/man/places_personal_crime.Rd new file mode 100644 index 0000000..2080026 --- /dev/null +++ b/man/places_personal_crime.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{places_personal_crime} +\alias{places_personal_crime} +\title{Rates of Personal Crime per 1,000 (2017)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{personal_crime_per_1k}{Number of personal crimes per 1,000 people} +\item{year}{Year} + +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +places_personal_crime +} +\description{ +A dataset containing statistics on 'personal crime' per 1,000 people in +Northern Irish Council Areas. 'Personal crime' is defined as violence against +the person, sexual offences, robbery, theft, criminal damage, and arson. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index c6393ec..9bedf2b 100644 --- a/metadata.md +++ b/metadata.md @@ -62,7 +62,7 @@ | Healthy Places | Distance to GP Services | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Distance to Pharmacies | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Distance to Sports or Leisure Facilities | :x: | :x: | :x: | :x: - data unavailable | :x: | -| Healthy Places | Personal Crime | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | +| Healthy Places | Personal Crime | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Personal crime per 1,000 people. | :heavy_check_mark: | | Healthy Places | Air Pollution | 2019 | [DEFRA](https://uk-air.defra.gov.uk/data/pcm-data) | [OGL3](https://www.gov.scot/crown-copyright/) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Places | Neighbourhood noise | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Places | Road Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | From 6483e990b63c913e6586cf3b0ee39b4bdb13ee0a Mon Sep 17 00:00:00 2001 From: MikeJohnPage <38110953+MikeJohnPage@users.noreply.github.com> Date: Thu, 28 Nov 2024 15:04:52 +0100 Subject: [PATCH 16/78] Refactor code to be more idiomatic --- data-raw/healthy-lives/young-peoples-training.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data-raw/healthy-lives/young-peoples-training.R b/data-raw/healthy-lives/young-peoples-training.R index b0fae20..3e6351d 100644 --- a/data-raw/healthy-lives/young-peoples-training.R +++ b/data-raw/healthy-lives/young-peoples-training.R @@ -19,16 +19,16 @@ lives_young_peoples_training <- young_peoples_raw |> "% of School Leavers with Destination: Training" ) ) |> - group_by(LGD2014) |> - mutate(young_peoples_eet_percentage = sum(VALUE, na.rm = TRUE)) |> - distinct(LGD2014, .keep_all = TRUE) |> + summarise( + young_peoples_eet_percentage = sum(VALUE, na.rm = TRUE), + .by = c(`Academic Year`, "LGD2014") + ) |> select( ltla24_code = LGD2014, young_peoples_eet_percentage, year = `Academic Year` ) |> - ungroup() |> - slice(-12) + filter(ltla24_code != "N92000002") # ---- Save output to data/ folder ---- usethis::use_data(lives_young_peoples_training, overwrite = TRUE) From d8358b748b6c0824d7f58483a180d9b430e30f93 Mon Sep 17 00:00:00 2001 From: MikeJohnPage <38110953+MikeJohnPage@users.noreply.github.com> Date: Thu, 28 Nov 2024 15:24:49 +0100 Subject: [PATCH 17/78] Refactor code to be more idiomatic --- data-raw/healthy-lives/overweight-obesity-children.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data-raw/healthy-lives/overweight-obesity-children.R b/data-raw/healthy-lives/overweight-obesity-children.R index 1959f49..4bde1e8 100644 --- a/data-raw/healthy-lives/overweight-obesity-children.R +++ b/data-raw/healthy-lives/overweight-obesity-children.R @@ -18,16 +18,16 @@ lives_childhood_overweight_obesity <- childhood_overweight_obesity_raw |> "Proportion of Y8 children who are overweight or obese" ) ) |> - group_by(LGD2014) |> - mutate(overweight_obesity_percentage = mean(VALUE, na.rm = TRUE)) |> - distinct(LGD2014, .keep_all = TRUE) |> - ungroup() |> + summarise( + overweight_obesity_percentage = mean(VALUE, na.rm = TRUE), + .by = c(`Academic Year`, "LGD2014") + ) |> select( ltla24_code = LGD2014, overweight_obesity_percentage, year = `Academic Year` ) |> - slice(-12) + filter(ltla24_code != "N92000002") # ---- Save output to data/ folder ---- usethis::use_data(lives_childhood_overweight_obesity, overwrite = TRUE) From 691f7a9653897fe41972fc0c158e056e42baf221 Mon Sep 17 00:00:00 2001 From: MikeJohnPage <38110953+MikeJohnPage@users.noreply.github.com> Date: Thu, 28 Nov 2024 15:31:04 +0100 Subject: [PATCH 18/78] Make row removal more explicity so that when reading the code, the intent is clear. --- data-raw/healthy-people/mortality-all-causes.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-raw/healthy-people/mortality-all-causes.R b/data-raw/healthy-people/mortality-all-causes.R index 1a95ae2..445c7f3 100644 --- a/data-raw/healthy-people/mortality-all-causes.R +++ b/data-raw/healthy-people/mortality-all-causes.R @@ -13,7 +13,7 @@ people_all_mortality <- all_mortality_raw |> SEX == "All", `Grouped Year` == "2020-22" ) |> - slice(-12) |> + filter(LGD2014 != "N92000002") |> select( ltla24_code = LGD2014, death_rate_per_100k = VALUE, From 03bc2e5c5be6616231f6b959db55ac2c19fe36fe Mon Sep 17 00:00:00 2001 From: MikeJohnPage <38110953+MikeJohnPage@users.noreply.github.com> Date: Thu, 28 Nov 2024 15:37:57 +0100 Subject: [PATCH 19/78] Clean up script --- data-raw/healthy-people/anxiety.R | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/data-raw/healthy-people/anxiety.R b/data-raw/healthy-people/anxiety.R index 4b13a45..214dd48 100644 --- a/data-raw/healthy-people/anxiety.R +++ b/data-raw/healthy-people/anxiety.R @@ -1,13 +1,11 @@ # ---- Load packages ---- library(tidyverse) -library(rio) -library(geographr) # ---- Get and clean data ---- # Anxiety # Source: https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4 -anxiety_raw <- import("https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/4.csv") +anxiety_raw <- read_csv("https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/4.csv") people_anxiety <- anxiety_raw |> filter( @@ -16,7 +14,7 @@ people_anxiety <- anxiety_raw |> `yyyy-yy` == "2022-23", `wellbeing-estimate` == "average-mean" ) |> - slice(-11) |> + filter(`administrative-geography` != "N92000002") |> select( ltla24_code = `administrative-geography`, anxiety_score_out_of_10 = `v4_3`, From 5dd7b4c4276f34ddaf5afd06f22c93894017628e Mon Sep 17 00:00:00 2001 From: MikeJohnPage <38110953+MikeJohnPage@users.noreply.github.com> Date: Thu, 28 Nov 2024 15:51:40 +0100 Subject: [PATCH 20/78] Refactor --- data-raw/healthy-people/life-worthwhileness.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/data-raw/healthy-people/life-worthwhileness.R b/data-raw/healthy-people/life-worthwhileness.R index 804ca86..a6f27be 100644 --- a/data-raw/healthy-people/life-worthwhileness.R +++ b/data-raw/healthy-people/life-worthwhileness.R @@ -1,12 +1,11 @@ # ---- Load packages ---- library(tidyverse) -library(rio) # ---- Get and clean data ---- # Life worthwhileness # Source: https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4 -life_worthwhileness_raw <- import("https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/4.csv") +life_worthwhileness_raw <- read_csv("https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/4.csv") people_life_worthwhileness <- life_worthwhileness_raw |> filter( @@ -15,7 +14,7 @@ people_life_worthwhileness <- life_worthwhileness_raw |> `yyyy-yy` == "2022-23", `wellbeing-estimate` == "average-mean" ) |> - slice(-11) |> + filter(`administrative-geography` != "N92000002") |> select( ltla24_code = `administrative-geography`, worthwhile_score_out_of_10 = `v4_3`, From ebee1c1c49e5ff424524bc27ecfe594518e3ad48 Mon Sep 17 00:00:00 2001 From: MikeJohnPage <38110953+MikeJohnPage@users.noreply.github.com> Date: Thu, 28 Nov 2024 15:55:18 +0100 Subject: [PATCH 21/78] Refactor --- data-raw/healthy-people/life-satisfaction.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/data-raw/healthy-people/life-satisfaction.R b/data-raw/healthy-people/life-satisfaction.R index 6762063..69722ef 100644 --- a/data-raw/healthy-people/life-satisfaction.R +++ b/data-raw/healthy-people/life-satisfaction.R @@ -1,12 +1,11 @@ # ---- Load packages ---- library(tidyverse) -library(rio) # ---- Get and clean data ---- # Life Satisfaction # Source: https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4 -life_satisfaction_raw <- import("https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/4.csv") +life_satisfaction_raw <- read_csv("https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/4.csv") people_life_satisfaction <- life_satisfaction_raw |> filter( @@ -15,7 +14,7 @@ people_life_satisfaction <- life_satisfaction_raw |> `yyyy-yy` == "2022-23", `wellbeing-estimate` == "average-mean" ) |> - slice(-11) |> + filter(`administrative-geography` != "N92000002") |> select( ltla24_code = `administrative-geography`, satisfaction_score_out_of_10 = `v4_3`, From f97c789cf9f6e8a48bf3fb6ed2f1f06910bdc4f0 Mon Sep 17 00:00:00 2001 From: MikeJohnPage <38110953+MikeJohnPage@users.noreply.github.com> Date: Thu, 28 Nov 2024 16:04:20 +0100 Subject: [PATCH 22/78] refactor code to make it more idiomatic --- data-raw/healthy-places/personal-crimes.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data-raw/healthy-places/personal-crimes.R b/data-raw/healthy-places/personal-crimes.R index cdd4d69..a5b58a0 100644 --- a/data-raw/healthy-places/personal-crimes.R +++ b/data-raw/healthy-places/personal-crimes.R @@ -15,10 +15,10 @@ places_personal_crime <- personal_crime_raw |> "Rate of Theft (per 1,000 population)", "Rate of Criminal Damage and Arson (per 1,000 population)" )) |> - group_by(LGD2014) |> - mutate(personal_crime_per_1k = sum(VALUE, na.rm = TRUE)) |> - ungroup() |> - distinct(LGD2014, .keep_all = TRUE) |> + summarise( + personal_crime_per_1k = sum(VALUE, na.rm = TRUE), + .by = c(`Ad-hoc year`, "LGD2014") + ) |> select( ltla24_code = LGD2014, personal_crime_per_1k, From 746837c0cde4aee68804d12a992cf8c246ffd612 Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 4 Dec 2024 09:29:04 +0000 Subject: [PATCH 23/78] Updated happiness - removed unnecessary code Updated happiness - removed unnecessary code --- data-raw/healthy-people/happiness.R | 35 ----------------------------- 1 file changed, 35 deletions(-) diff --git a/data-raw/healthy-people/happiness.R b/data-raw/healthy-people/happiness.R index 024c16b..0f4ba94 100644 --- a/data-raw/healthy-people/happiness.R +++ b/data-raw/healthy-people/happiness.R @@ -24,38 +24,3 @@ people_happiness <- happiness_raw |> # ---- Save output to data/ folder ---- usethis::use_data(people_happiness, overwrite = TRUE) - - -# ---- Load ---- -library(tidyverse) -library(httr) -library(readxl) -library(geographr) -library(sf) - -source("R/utils.R") - -# ---- Extract data ---- -# Source: https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/1 -GET( - "https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/1.xlsx", - write_disk(tf <- tempfile(fileext = ".xlsx")) -) - -happiness_raw <- - read_excel(tf, sheet = "Dataset", skip = 2) - -# The 'Average (mean)' estimate provides the score out of 0-10. The other estimates are -# thresholds (percentages) described in the QMI: https://www.ons.gov.uk/peoplepopulationandcommunity/wellbeing/methodologies/personalwellbeingintheukqmi -happiness <- - happiness_raw |> - filter(Estimate == "Average (mean)") |> - filter(MeasureOfWellbeing == "Happiness") |> - select( - lad_code = `Geography code`, - happiness_score_out_of_10 = `2019-20` - ) |> - filter_codes(lad_code, "^N") |> - filter(lad_code != "N92000002") - -write_rds(happiness, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/happiness.rds") From 1da0fe7b45821e4de66f6cf68a52822d090b9efb Mon Sep 17 00:00:00 2001 From: CatReid Date: Thu, 5 Dec 2024 16:35:28 +0000 Subject: [PATCH 24/78] Corrections - happiness Corrections - happiness --- R/data.R | 2 ++ data-raw/healthy-people/happiness.R | 5 ++--- data/people_happiness.rda | Bin 334 -> 342 bytes 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/R/data.R b/R/data.R index be94bc4..327711a 100644 --- a/R/data.R +++ b/R/data.R @@ -240,6 +240,8 @@ #' @format A data frame with 11 rows and 3 variables: #' \describe{ #' \item{ltla24_code}{Local Authority Code} +#' \item{satisfaction_score_out_of_10}{Average personal ratings on feelings of +#' life satisfaction out of 10 - 10 is most satisfied, 1 is least satisfied} #' \item{year}{Time period} #' ... #' } diff --git a/data-raw/healthy-people/happiness.R b/data-raw/healthy-people/happiness.R index 0f4ba94..0d36a75 100644 --- a/data-raw/healthy-people/happiness.R +++ b/data-raw/healthy-people/happiness.R @@ -1,12 +1,11 @@ # ---- Load packages ---- library(tidyverse) -library(rio) # ---- Get and clean data ---- # Happiness # Source: https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4 -happiness_raw <- import("https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/4.csv") +happiness_raw <- read_csv("https://download.ons.gov.uk/downloads/datasets/wellbeing-local-authority/editions/time-series/versions/4.csv") people_happiness <- happiness_raw |> filter( @@ -15,7 +14,7 @@ people_happiness <- happiness_raw |> `yyyy-yy` == "2022-23", `wellbeing-estimate` == "average-mean" ) |> - slice(-11) |> + filter(`administrative-geography` != "N92000002") |> select( ltla24_code = `administrative-geography`, happiness_score_out_of_10 = `v4_3`, diff --git a/data/people_happiness.rda b/data/people_happiness.rda index 08c546de0ec82207de81497510c765a9d24a50a5..295f5ed878d002d4772ec5a82c385e16fd465f99 100644 GIT binary patch delta 332 zcmV-S0ki(j0@eZ`LRx4!F+o`-Q&|dhMf3mxD}UeryG$p5Lx18#fiOhBksuX+gG8p9 zG5`Po0ilosKmcfH^#f3bnns?G00E!?000d%X`lirO(~`(fXSmnKpHd#MogLj003YZ zf|Q0(PzXZ=n{6VGM^t3`;z$-K3zzGBQ~(f~TdYx_C5^b6)vev@bnTfKs!dxgEW)~= z1R&8NVGpSUnc`>!9&f^|fv56+a73;Tv~clCL=a%4r$?rFoPbwT8B7XKUlvg{S_*P0 zNlVI9okF0@f`mbl)-+daOw0Cn#W%D~5e0y19@gDw0}OdQhKGY}PcJ)yTKEH>XGEy-ZXG2{nA e49IupPqZW?Drp1v?jZpGi@744C`bi5BKiPk0fW{6 delta 324 zcmV-K0lWUz0?q;;LRx4!F+o`-Q(1;*rS1R$BY)riyG$p5Lx18#fiOg`ksuX+u+d4T zLqU)<4FCYp&;vj;29HQIrl+G*H8jxB05kvq00E(3 zXkv(>>160h5F-Xnwwi<5#~C2&6cVZuAajYq5Gt*MgwWcFu3X!@dW*$lE-A?kI2TY> z5OK%?5c`lxo+gA;^7#_sf_K?VvG==IGhKr@uaQv#Fc^yL#-sHOEN zQ;|yZsZfX@nGnW1FuV3y&H9hj-E5m85kPKE?QiqNgVDH?&Ug<66MKb~+Ii)WpHHe8 z2<(?u5xkkpgoy8jmu$vq)&ndJ4+Bm;MW`8tl!QJc%A Date: Mon, 16 Dec 2024 09:18:15 +0000 Subject: [PATCH 25/78] Added low-level crime to metadata Added low-level crime to metadata --- metadata.md | 1 + 1 file changed, 1 insertion(+) diff --git a/metadata.md b/metadata.md index 0244843..ceee8b5 100644 --- a/metadata.md +++ b/metadata.md @@ -63,6 +63,7 @@ | Healthy Places | Distance to Pharmacies | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Distance to Sports or Leisure Facilities | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Personal Crime | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Personal crime per 1,000 people. | :heavy_check_mark: | +| Healthy Places | Low-Level Crime | :X: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Places | Air Pollution | 2019 | [DEFRA](https://uk-air.defra.gov.uk/data/pcm-data) | [OGL3](https://www.gov.scot/crown-copyright/) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Places | Neighbourhood noise | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Places | Road Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | From 632ba9a1dcdf26d49a925282bae01e64e905b5a5 Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 16 Dec 2024 09:30:25 +0000 Subject: [PATCH 26/78] Added internet access to metadata Added internet access to metadata --- metadata.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/metadata.md b/metadata.md index ceee8b5..5e8f1a7 100644 --- a/metadata.md +++ b/metadata.md @@ -63,10 +63,11 @@ | Healthy Places | Distance to Pharmacies | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Distance to Sports or Leisure Facilities | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Personal Crime | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Personal crime per 1,000 people. | :heavy_check_mark: | -| Healthy Places | Low-Level Crime | :X: | :x: | :x: | :x: Data unavailable. | :x: | +| Healthy Places | Low-Level Crime | :X: | :x: | :x: | :x: TO DO. | :x: | | Healthy Places | Air Pollution | 2019 | [DEFRA](https://uk-air.defra.gov.uk/data/pcm-data) | [OGL3](https://www.gov.scot/crown-copyright/) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Places | Neighbourhood noise | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Places | Road Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | -| Healthy Places | Road Traffic Volume | :x: | :x: | :x: | :x: - data unavailable | :x: | +| Healthy Places | Road Traffic Volume | :x: | :x: | :x: | :x: TO DO | :x: | +| Healthy Places | Internet access | :x: | :x: | :x: | :x: TO DO | :x: | | Healthy Places | Transport noise: Daytime | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: - Separate data was not available for day & night, so just one metric has been used | :heavy_check_mark: | | Healthy Places | Transport noise: Nighttime | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: - Separate data was not available for day & night, so just one metric has been used | :heavy_check_mark: | From dcde077896d223e7ec80db563d9af279265397cf Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 16 Dec 2024 09:58:04 +0000 Subject: [PATCH 27/78] First draft completed - internet-access First draft completed - internet-access, styled and rendered --- R/data.R | 18 ++++++++++++++ data-raw/healthy-places/internet-access.R | 24 +++++++++++++++++++ data/places_internet_access.rda | Bin 0 -> 293 bytes man/places_internet_access.Rd | 28 ++++++++++++++++++++++ metadata.md | 2 +- 5 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 data-raw/healthy-places/internet-access.R create mode 100644 data/places_internet_access.rda create mode 100644 man/places_internet_access.Rd diff --git a/R/data.R b/R/data.R index 327711a..8ab70d9 100644 --- a/R/data.R +++ b/R/data.R @@ -267,6 +267,24 @@ #' @source \url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} "people_mental_health" +#' Percentage of Households without Internet Access (2021/22) +#' +#' A dataset containing statistics on the percentage of households without +#' internet access in Northern Irish Council Areas. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{no_internet_access_percentage}{Percentage of households without access +#' to the internet} +#' \item{year}{Financial Year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +#' +"places_internet_access" + #' Rates of Personal Crime per 1,000 (2017) #' #' A dataset containing statistics on 'personal crime' per 1,000 people in diff --git a/data-raw/healthy-places/internet-access.R b/data-raw/healthy-places/internet-access.R new file mode 100644 index 0000000..f8cc3bc --- /dev/null +++ b/data-raw/healthy-places/internet-access.R @@ -0,0 +1,24 @@ +# ---- Load packages ---- +library(tidyverse) + +# ---- Get data ---- +# Internet access +# Source: https://data.nisra.gov.uk/ + +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/HHIBALGD/CSV/1.0/" +internet_access_raw <- read_csv(url) + +places_internet_access <- internet_access_raw |> + filter( + `Financial Year` == "2021/22", + `Statistic Label` == "Households with Home Internet Access: No", + `LGD2014` != "N92000002" + ) |> + select( + ltla24_code = `LGD2014`, + no_internet_access_percentage = VALUE, + year = `Financial Year` + ) + +# ---- Save output to data/ folder ---- +usethis::use_data(places_internet_access, overwrite = TRUE) diff --git a/data/places_internet_access.rda b/data/places_internet_access.rda new file mode 100644 index 0000000000000000000000000000000000000000..78f27e6b00a7aca3bc85d1438fb4e963b726e47b GIT binary patch literal 293 zcmV+=0owjTT4*^jL0KkKSx8Czb^rl5|G@vdNd{F#|KLOc5J11D+@L@J0s*i9<}4*7 zO{s~dAYuWa0002mf+^}F2w+T11j(jM0T@h}Ac{zlv=eG*3{4DbXbl>AMuC$o&n(kR zGQ~>xR(wLlk``lAibN5zM!erpw$2Qpq)##n*U~BKk*y|t`HjxYaRq}z?owl^6 r6lE3|LU$AP8e|bPae~Y;yoG3^nB>p=9&%uC< literal 0 HcmV?d00001 diff --git a/man/places_internet_access.Rd b/man/places_internet_access.Rd new file mode 100644 index 0000000..11039a8 --- /dev/null +++ b/man/places_internet_access.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{places_internet_access} +\alias{places_internet_access} +\title{Percentage of Households without Internet Access (2021/22)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{no_internet_access_percentage}{Percentage of households without access +to the internet} +\item{year}{Financial Year} + +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +places_internet_access +} +\description{ +A dataset containing statistics on the percentage of households without +internet access in Northern Irish Council Areas. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 5e8f1a7..d8cce60 100644 --- a/metadata.md +++ b/metadata.md @@ -68,6 +68,6 @@ | Healthy Places | Neighbourhood noise | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Places | Road Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Road Traffic Volume | :x: | :x: | :x: | :x: TO DO | :x: | -| Healthy Places | Internet access | :x: | :x: | :x: | :x: TO DO | :x: | +| Healthy Places | Internet access | 2021/22 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage of households without access to the internet at home. | :heavy_check_mark:| | Healthy Places | Transport noise: Daytime | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: - Separate data was not available for day & night, so just one metric has been used | :heavy_check_mark: | | Healthy Places | Transport noise: Nighttime | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: - Separate data was not available for day & night, so just one metric has been used | :heavy_check_mark: | From 46deaa47cb6f1c2e2a4566020b76726e3527f44b Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 17 Dec 2024 08:34:27 +0000 Subject: [PATCH 28/78] Updated low-level crime - data unavailable Updated low-level crime - data unavailable --- metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.md b/metadata.md index 5e8f1a7..e3e4802 100644 --- a/metadata.md +++ b/metadata.md @@ -63,7 +63,7 @@ | Healthy Places | Distance to Pharmacies | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Distance to Sports or Leisure Facilities | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Personal Crime | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Personal crime per 1,000 people. | :heavy_check_mark: | -| Healthy Places | Low-Level Crime | :X: | :x: | :x: | :x: TO DO. | :x: | +| Healthy Places | Low-Level Crime | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Places | Air Pollution | 2019 | [DEFRA](https://uk-air.defra.gov.uk/data/pcm-data) | [OGL3](https://www.gov.scot/crown-copyright/) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Places | Neighbourhood noise | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Places | Road Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | From 97a2e4d0d5aeb66137ad69dc29b2d628e9a2530a Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 17 Dec 2024 08:46:17 +0000 Subject: [PATCH 29/78] Updated acceptable-gp-appointments - data unavailable Updated acceptable-gp-appointments - data unavailable --- metadata.md | 1 + 1 file changed, 1 insertion(+) diff --git a/metadata.md b/metadata.md index e3e4802..923bd7e 100644 --- a/metadata.md +++ b/metadata.md @@ -62,6 +62,7 @@ | Healthy Places | Distance to GP Services | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Distance to Pharmacies | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Distance to Sports or Leisure Facilities | :x: | :x: | :x: | :x: - data unavailable | :x: | +| Healthy Places | Patients offered acceptable GP practice appointments | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Places | Personal Crime | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Personal crime per 1,000 people. | :heavy_check_mark: | | Healthy Places | Low-Level Crime | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Places | Air Pollution | 2019 | [DEFRA](https://uk-air.defra.gov.uk/data/pcm-data) | [OGL3](https://www.gov.scot/crown-copyright/) | :heavy_check_mark: | :heavy_check_mark: | From 86b6f71a3dc3b8d287b2d7ad0760bb7f1282fbd1 Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 17 Dec 2024 09:39:04 +0000 Subject: [PATCH 30/78] First draft completed - air-pollution First draft completed - air-pollution. Code updated from original script, styled and rendered. --- R/data.R | 16 +++++++++++ data-raw/healthy-places/air-pollution.R | 34 +++++++++++++++--------- data/places_air_pollution.rda | Bin 0 -> 380 bytes man/places_air_pollution.Rd | 27 +++++++++++++++++++ metadata.md | 2 +- 5 files changed, 65 insertions(+), 14 deletions(-) create mode 100644 data/places_air_pollution.rda create mode 100644 man/places_air_pollution.Rd diff --git a/R/data.R b/R/data.R index 327711a..a8336fb 100644 --- a/R/data.R +++ b/R/data.R @@ -267,6 +267,22 @@ #' @source \url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} "people_mental_health" +#' Air pollution (2019) +#' +#' A dataset containing population-weighted annual mean PM2.5 data for 2019, by +#' Northern Irish Council Area. Uses the anthropogenic component. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{air_pollution_weighted}{Population-weighted annual mean PM2.5} +#' \item{year}{Year} +#' +#' ... +#' } +#' @source \url{https://uk-air.defra.gov.uk/data/pcm-data} +"places_air_pollution" + #' Rates of Personal Crime per 1,000 (2017) #' #' A dataset containing statistics on 'personal crime' per 1,000 people in diff --git a/data-raw/healthy-places/air-pollution.R b/data-raw/healthy-places/air-pollution.R index a9bf171..9b28593 100644 --- a/data-raw/healthy-places/air-pollution.R +++ b/data-raw/healthy-places/air-pollution.R @@ -1,13 +1,15 @@ +# ---- Load packages ---- library(tidyverse) library(geographr) -# Lookup -lookup <- - boundaries_lad |> - select(-geometry) |> - st_drop_geometry() |> - filter(str_detect(lad_code, "^N")) +# ---- Get data ---- +# LA Codes +ltla_lookup <- lookup_ltla_ltla |> + filter(str_detect(ltla23_code, "N")) |> + select(ltla23_code, ltla23_name) + +# Air Pollution # Source: https://uk-air.defra.gov.uk/data/pcm-data air_pollution_raw <- read_csv( @@ -19,14 +21,20 @@ air_pollution_raw <- air_pollution <- air_pollution_raw |> select( - lad_name = `Local Authority`, + ltla23_name = `Local Authority`, air_pollution_weighted = `PM2.5 2019 (anthropogenic)` ) -# Join -air_pollution <- - lookup |> - left_join(air_pollution, by = "lad_name") |> - select(-lad_name) +# Join datasets +places_air_pollution <- + ltla_lookup |> + left_join(air_pollution, by = "ltla23_name") |> + select( + ltla24_code = ltla23_code, + air_pollution_weighted, + -ltla23_name + ) |> + mutate(year = "2019") -write_rds(air_pollution, "data/vulnerability/health-inequalities/northern-ireland/healthy-places/air-pollution.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(places_air_pollution, overwrite = TRUE) diff --git a/data/places_air_pollution.rda b/data/places_air_pollution.rda new file mode 100644 index 0000000000000000000000000000000000000000..ac81542ca8bba3b7a1552d2dbb715892dafbf4c1 GIT binary patch literal 380 zcmV-?0fYWRT4*^jL0KkKS;~#l<^Ta0|Ns9x|APimf8kU?5K_PI-lIT703ZNCg5iiM z5CuVD0x7To7+Mh&13(P`00003KmarV20+p3Xd?SoPzEYR+C@~3$k;OrRErOjevv8UfzcR>5P)igAlgK4BI|#;N+#BJ zR$n#5Ag^l9Q?nB7ik8CbWTC2ngcQYOz<_}Bn7oCMZ`92!HStfRh^rVJ2qFb Date: Tue, 17 Dec 2024 10:16:02 +0000 Subject: [PATCH 31/78] Updated noise-complaints - TBC Updated noise-complaints - need to email aeqteam@daera-ni.gov.uk for access to raw data (figure 1 of report) --- .../{neighbourhood-noise.R => noise-complaints.R} | 0 metadata.md | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename data-raw/healthy-places/{neighbourhood-noise.R => noise-complaints.R} (100%) diff --git a/data-raw/healthy-places/neighbourhood-noise.R b/data-raw/healthy-places/noise-complaints.R similarity index 100% rename from data-raw/healthy-places/neighbourhood-noise.R rename to data-raw/healthy-places/noise-complaints.R diff --git a/metadata.md b/metadata.md index 923bd7e..78b3aa8 100644 --- a/metadata.md +++ b/metadata.md @@ -66,7 +66,7 @@ | Healthy Places | Personal Crime | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Personal crime per 1,000 people. | :heavy_check_mark: | | Healthy Places | Low-Level Crime | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Places | Air Pollution | 2019 | [DEFRA](https://uk-air.defra.gov.uk/data/pcm-data) | [OGL3](https://www.gov.scot/crown-copyright/) | :heavy_check_mark: | :heavy_check_mark: | -| Healthy Places | Neighbourhood noise | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | +| Healthy Places | Noise Complaints | 2024 | [DAERA](https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Raw data currently unavailable (only in a report). Need to contact aeqteam@daera-ni.gov.uk and ask for raw data in Figure 1 of report | :heavy_exclamation_mark: | | Healthy Places | Road Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Road Traffic Volume | :x: | :x: | :x: | :x: TO DO | :x: | | Healthy Places | Internet access | :x: | :x: | :x: | :x: TO DO | :x: | From ebe2ffb75399bd1e3a8548ff1269e257c7c7102e Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 17 Dec 2024 10:21:45 +0000 Subject: [PATCH 32/78] Updated metadata - transport-noise not in England's HI Updated metadata - transport-noise not in England's HI. To review at the end --- metadata.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.md b/metadata.md index 78b3aa8..19d6ce9 100644 --- a/metadata.md +++ b/metadata.md @@ -70,5 +70,5 @@ | Healthy Places | Road Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Road Traffic Volume | :x: | :x: | :x: | :x: TO DO | :x: | | Healthy Places | Internet access | :x: | :x: | :x: | :x: TO DO | :x: | -| Healthy Places | Transport noise: Daytime | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: - Separate data was not available for day & night, so just one metric has been used | :heavy_check_mark: | -| Healthy Places | Transport noise: Nighttime | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: - Separate data was not available for day & night, so just one metric has been used | :heavy_check_mark: | +| Healthy Places | Transport noise: Daytime | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :x: Indicator not overtly present in England's Health Index. To review at the end. | :x: | +| Healthy Places | Transport noise: Nighttime | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :x: Indicator not overtly present in England's Health Index. To review at the end. | :x: | From b3fc185ae8908b367833de5a6d39c19ee2b27d14 Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 17 Dec 2024 10:24:25 +0000 Subject: [PATCH 33/78] Updated metadata - road traffic volume Updated metadata - road traffic volume. Not in England's HI. To review at the end --- metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.md b/metadata.md index 19d6ce9..9641652 100644 --- a/metadata.md +++ b/metadata.md @@ -68,7 +68,7 @@ | Healthy Places | Air Pollution | 2019 | [DEFRA](https://uk-air.defra.gov.uk/data/pcm-data) | [OGL3](https://www.gov.scot/crown-copyright/) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Places | Noise Complaints | 2024 | [DAERA](https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Raw data currently unavailable (only in a report). Need to contact aeqteam@daera-ni.gov.uk and ask for raw data in Figure 1 of report | :heavy_exclamation_mark: | | Healthy Places | Road Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | -| Healthy Places | Road Traffic Volume | :x: | :x: | :x: | :x: TO DO | :x: | +| Healthy Places | Road Traffic Volume | :x: | :x: | :x: | :x: Indicator not overtly present in England's Health Index. To review at the end. | :x: | | Healthy Places | Internet access | :x: | :x: | :x: | :x: TO DO | :x: | | Healthy Places | Transport noise: Daytime | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :x: Indicator not overtly present in England's Health Index. To review at the end. | :x: | | Healthy Places | Transport noise: Nighttime | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :x: Indicator not overtly present in England's Health Index. To review at the end. | :x: | From c79330eb9cdd9f670578cf113b167af262b1d0ae Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 17 Dec 2024 11:21:20 +0000 Subject: [PATCH 34/78] First draft completed - road-safety First draft completed - road-safety, styled and rendered. --- R/data.R | 16 ++++++++ data-raw/healthy-places/road-safety.R | 51 ++++++++++++++++++++++++++ data/places_road_safety.rda | Bin 0 -> 319 bytes man/places_road_safety.Rd | 27 ++++++++++++++ metadata.md | 2 +- 5 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 data-raw/healthy-places/road-safety.R create mode 100644 data/places_road_safety.rda create mode 100644 man/places_road_safety.Rd diff --git a/R/data.R b/R/data.R index 327711a..31056f8 100644 --- a/R/data.R +++ b/R/data.R @@ -285,6 +285,22 @@ #' "places_personal_crime" +#' Road safety (2023) +#' +#' A dataset containing number of people killed or seriously injured in each +#' Northern Irish Council Area in 2023 (latest available data). +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{road_accident_count}{Number of people killed or seriously injured, per Local Authority} +#' \item{year}{Year} +#' +#' ... +#' } +#' @source \url{https://www.psni.police.uk/about-us/our-publications-and-reports/official-statistics/road-traffic-collision-statistics} +"places_road_safety" + #' Rate of Self-Harm Related Admissions per 100,000 (2018/19-2022/23) #' #' A dataset containing statistics on the rate of self-harm related admissions diff --git a/data-raw/healthy-places/road-safety.R b/data-raw/healthy-places/road-safety.R new file mode 100644 index 0000000..45d2f41 --- /dev/null +++ b/data-raw/healthy-places/road-safety.R @@ -0,0 +1,51 @@ +# ---- Load packages ---- +library(tidyverse) +library(geographr) +library(readxl) + +# ---- Get data and clean ---- +# LA Codes +ltla_lookup <- lookup_ltla_ltla |> + filter(str_detect(ltla23_code, "N")) |> + select(ltla23_code, ltla23_name) + +# Road Safety Data +# Source: https://www.psni.police.uk/about-us/our-publications-and-reports/official-statistics/road-traffic-collision-statistics + +url <- "https://www.psni.police.uk/sites/default/files/2024-03/2023%20Key%20Statistics%20tables.xlsx" +temp_file <- tempfile(fileext = ".xlsx") +download.file(url, temp_file, mode = "wb") + +road_safety_raw <- read_excel(temp_file, sheet = 6, skip = 5) + +road_safety <- road_safety_raw |> + select( + ltla23_name = `Area`, + accident_count = `Total...11` + ) |> + slice(1:11) |> + mutate( + ltla23_name = ltla23_name |> + str_replace_all("&", "and") |> + str_replace_all("Belfast City", "Belfast") |> + str_replace_all("Lisburn & Castlereagh City", "Lisburn and Castlereagh") + ) + +# Join datasets +places_road_safety <- ltla_lookup |> + left_join(road_safety, by = "ltla23_name") |> + mutate( + accident_count = case_when( + is.na(accident_count) & ltla23_code == "N09000007" ~ 615, + TRUE ~ accident_count + ), + year = "2023" + ) |> + select( + ltla24_code = ltla23_code, + road_accident_count = accident_count, + year + ) + +# ---- Save output to data/ folder ---- +usethis::use_data(places_road_safety, overwrite = TRUE) diff --git a/data/places_road_safety.rda b/data/places_road_safety.rda new file mode 100644 index 0000000000000000000000000000000000000000..f2957da80df57d92ac53dd86d032afb77a48d820 GIT binary patch literal 319 zcmV-F0l@x3T4*^jL0KkKS=TB)xv8(9_TwGziGkC#j~&Z%{=~Q_-aK5vH1Hh{(}|XvDyV znlfYrl8`je000000000}an#6vQw1OK2U-J{!rWz-HULCn93Nh4Rbiq0D+rBLCs*Iz z!2mWeLQl)3X|Xlf;g=>^u=Z`Q1a1qe0e}Et6p@l-41vI4e9kfuEixQH`G;HX&eI-1 z6OtjMYe;_{7|~*+I*{|J5C&!Kiim=uTT{E{L_zdF24A`TuX;;SjNZIPNNbfJasXTeg|7er literal 0 HcmV?d00001 diff --git a/man/places_road_safety.Rd b/man/places_road_safety.Rd new file mode 100644 index 0000000..6db758a --- /dev/null +++ b/man/places_road_safety.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{places_road_safety} +\alias{places_road_safety} +\title{Road safety (2023)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{road_accident_count}{Number of people killed or seriously injured, per Local Authority} +\item{year}{Year} + +... +} +} +\source{ +\url{https://www.psni.police.uk/about-us/our-publications-and-reports/official-statistics/road-traffic-collision-statistics} +} +\usage{ +places_road_safety +} +\description{ +A dataset containing number of people killed or seriously injured in each +Northern Irish Council Area in 2023 (latest available data). +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 9641652..9c1d8e5 100644 --- a/metadata.md +++ b/metadata.md @@ -67,7 +67,7 @@ | Healthy Places | Low-Level Crime | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Places | Air Pollution | 2019 | [DEFRA](https://uk-air.defra.gov.uk/data/pcm-data) | [OGL3](https://www.gov.scot/crown-copyright/) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Places | Noise Complaints | 2024 | [DAERA](https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Raw data currently unavailable (only in a report). Need to contact aeqteam@daera-ni.gov.uk and ask for raw data in Figure 1 of report | :heavy_exclamation_mark: | -| Healthy Places | Road Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | +| Healthy Places | Road Safety | 2023 | [PSNI](https://www.psni.police.uk/about-us/our-publications-and-reports/official-statistics/road-traffic-collision-statistics)| [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Number of people seriously injured or killed by Local Authority area. | :heavy_check_mark: | | Healthy Places | Road Traffic Volume | :x: | :x: | :x: | :x: Indicator not overtly present in England's Health Index. To review at the end. | :x: | | Healthy Places | Internet access | :x: | :x: | :x: | :x: TO DO | :x: | | Healthy Places | Transport noise: Daytime | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :x: Indicator not overtly present in England's Health Index. To review at the end. | :x: | From 13d46f8af38aff97d745a027f2d77717e248f610 Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 17 Dec 2024 14:52:24 +0000 Subject: [PATCH 35/78] First draft started - HLE First draft started - HLE. Raw data uploaded; being split into male and female to then be combined --- .../healthy-people/healthy-life-expectancy.R | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/data-raw/healthy-people/healthy-life-expectancy.R b/data-raw/healthy-people/healthy-life-expectancy.R index 874e3e3..6e7e1ea 100644 --- a/data-raw/healthy-people/healthy-life-expectancy.R +++ b/data-raw/healthy-people/healthy-life-expectancy.R @@ -1,3 +1,39 @@ +# ---- Load packages ---- +library(tidyverse) +library(readxl) +library(geographr) + +# ---- Get and clean data ---- +# Healthy Life Expectancy +# Source: https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/healthandlifeexpectancies/datasets/lifeexpectancyforlocalareasinenglandnorthernirelandandwalesbetween2001to2003and2020to2022 + +url <- "https://www.ons.gov.uk/file?uri=/peoplepopulationandcommunity/healthandsocialcare/healthandlifeexpectancies/datasets/lifeexpectancyforlocalareasinenglandnorthernirelandandwalesbetween2001to2003and2020to2022/between2001to2003and2020to2022/lifeexpectancylocalareas.xlsx" +temp_file <- tempfile(fileext = ".xlsx") +download.file(url, temp_file, mode = "wb") + +hle_raw <- read_excel(temp_file, sheet = 5, skip = 11) + + +# Healthy Life Expectancy (Male) + +male_hle <- hle_raw |> + filter(Sex == "Male", + str_starts(`Area code`, "N")) |> + select(ltla24_code = `Area code`) + + + + + + + +# Healthy Life Expectancy (Female) + +female_hle <- hle_raw |> + filter(Sex == "Female", + str_starts(`Area code`, "N")) + + # ---- Load libraries ---- library(tidyverse) library(httr) @@ -121,4 +157,4 @@ hle <- .groups = "drop" ) -write_rds(hle, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/healthy-life-expectancy.rds") \ No newline at end of file +write_rds(hle, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/healthy-life-expectancy.rds") From cf5b0d70dac3f3180d62f3ffc2fd7cd1c44ed4f9 Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 17 Dec 2024 16:35:11 +0000 Subject: [PATCH 36/78] Life-expectancy for males and females calculated Life-expectancy for males and females calculated. Pausing before calculating population-weighted average; to discuss in Jan '25. --- .../healthy-people/healthy-life-expectancy.R | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/data-raw/healthy-people/healthy-life-expectancy.R b/data-raw/healthy-people/healthy-life-expectancy.R index 6e7e1ea..3e9ee35 100644 --- a/data-raw/healthy-people/healthy-life-expectancy.R +++ b/data-raw/healthy-people/healthy-life-expectancy.R @@ -4,34 +4,52 @@ library(readxl) library(geographr) # ---- Get and clean data ---- -# Healthy Life Expectancy +# Life Expectancy (2020-2022) # Source: https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/healthandlifeexpectancies/datasets/lifeexpectancyforlocalareasinenglandnorthernirelandandwalesbetween2001to2003and2020to2022 url <- "https://www.ons.gov.uk/file?uri=/peoplepopulationandcommunity/healthandsocialcare/healthandlifeexpectancies/datasets/lifeexpectancyforlocalareasinenglandnorthernirelandandwalesbetween2001to2003and2020to2022/between2001to2003and2020to2022/lifeexpectancylocalareas.xlsx" temp_file <- tempfile(fileext = ".xlsx") download.file(url, temp_file, mode = "wb") -hle_raw <- read_excel(temp_file, sheet = 5, skip = 11) +le_raw <- read_excel(temp_file, sheet = 5, skip = 11) -# Healthy Life Expectancy (Male) +# Life Expectancy (Male) -male_hle <- hle_raw |> +male_le <- le_raw |> filter(Sex == "Male", - str_starts(`Area code`, "N")) |> - select(ltla24_code = `Area code`) + str_starts(`Area code`, "N"), + `Age group` == "<1", + `Area code` != "N92000002") |> + select(ltla24_code = `Area code`, + life_expectancy_male = `Life expectancy (years)...62`) +# Life Expectancy (Female) +female_le <- le_raw |> + filter(Sex == "Female", + str_starts(`Area code`, "N"), + `Age group` == "<1", + `Area code` != "N92000002") |> + select(ltla24_code = `Area code`, + life_expectancy_female = `Life expectancy (years)...62`) +# Join datasets +people_life_expectancy <- male_le |> + left_join(female_le, by = "ltla24_code") -# Healthy Life Expectancy (Female) +# TO DO: add in population data (from NISRA: 'Population totals, MYE01T06' OR +# 'Mid-year population estimates, MYE01T04 - probably this one). +# +# Then need to get population totals for males and females. Then combine male +# and female population to get total population for each council. +# +# Then need to calculate the weighted life expectancy - +# ((male-LE * male-pop) + (female-LE * female-pop)) / total-pop -female_hle <- hle_raw |> - filter(Sex == "Female", - str_starts(`Area code`, "N")) # ---- Load libraries ---- From c8c2de1d0a3e5d21b5dfc2f0612dabf322ba607e Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 7 Jan 2025 11:29:22 +0000 Subject: [PATCH 37/78] First draft completed - high-blood-pressure First draft completed - high-blood-pressure, styled and rendered. Prevalence per 1k converted to % --- R/data.R | 18 ++++++++++++ data-raw/healthy-lives/high-blood-pressure.R | 27 ++++++++++++++++++ data-raw/healthy-lives/hypertension.R | 26 ----------------- data/lives_high_blood_pressure.rda | Bin 0 -> 500 bytes man/lives_high_blood_pressure.Rd | 28 +++++++++++++++++++ metadata.md | 2 +- 6 files changed, 74 insertions(+), 27 deletions(-) create mode 100644 data-raw/healthy-lives/high-blood-pressure.R delete mode 100644 data-raw/healthy-lives/hypertension.R create mode 100644 data/lives_high_blood_pressure.rda create mode 100644 man/lives_high_blood_pressure.Rd diff --git a/R/data.R b/R/data.R index 327711a..f4c40c4 100644 --- a/R/data.R +++ b/R/data.R @@ -35,6 +35,24 @@ #' "lives_gsce_attainment" +#' Percentage of Adults Diagnosed with High Blood Pressure (2023-2024) +#' +#' A dataset containing statistics on percentage of adults diagnosed with high +#' blood pressure, by Council (2023-2024). +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{high_blood_pressure_percentage}{Percentage of adults diagnosed with +#' high blood pressure} +#' \item{year}{Time period - Financial year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +"lives_high_blood_pressure" + + #' Percentage of Babies Born Not at a Healthy Birth Weight (2022-2023) #' #' A dataset containing percentage babies born not at a healthy birth weight. diff --git a/data-raw/healthy-lives/high-blood-pressure.R b/data-raw/healthy-lives/high-blood-pressure.R new file mode 100644 index 0000000..0e49167 --- /dev/null +++ b/data-raw/healthy-lives/high-blood-pressure.R @@ -0,0 +1,27 @@ +# ---- Load packages ---- +library(tidyverse) + +# ---- Get and clean data ---- +# High Blood Pressure Data +# Source: https://data.nisra.gov.uk/ + +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/DISPREVLGD/CSV/1.0/" +high_blood_pressure_raw <- read_csv(url) + +lives_high_blood_pressure <- high_blood_pressure_raw |> + filter( + `Statistic Label` == "Raw disease prevalence per 1,000 patients", + `Disease` == "Hypertension", + `Financial Year` == "2023/24", + `LGD2014` != "N92000002" + ) |> + rowwise() |> + mutate(high_blood_pressure_percentage = VALUE / 10) |> + select( + ltla24_code = LGD2014, + high_blood_pressure_percentage, + year = `Financial Year` + ) + +# ---- Save output to data/ folder ---- +usethis::use_data(lives_high_blood_pressure, overwrite = TRUE) diff --git a/data-raw/healthy-lives/hypertension.R b/data-raw/healthy-lives/hypertension.R deleted file mode 100644 index 0b53fdb..0000000 --- a/data-raw/healthy-lives/hypertension.R +++ /dev/null @@ -1,26 +0,0 @@ -library(tidyverse) -library(httr) -library(readODS) - -GET( - "https://www.ninis2.nisra.gov.uk/Download/Health%20and%20Social%20Care/Disease%20Prevalence%20(Quality%20Outcomes%20Framework)%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) - -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "A4:AL15" - ) - -hypertension <- - raw |> - as_tibble() |> - select( - lad_code = `LGD2014 Code`, - hypertension_per_1000 = `Hypertension Register: Raw Prevalence per 1,000 patients` - ) - -# Save -write_rds(hypertension, "data/vulnerability/health-inequalities/northern-ireland/healthy-lives/hypertension.rds") \ No newline at end of file diff --git a/data/lives_high_blood_pressure.rda b/data/lives_high_blood_pressure.rda new file mode 100644 index 0000000000000000000000000000000000000000..b5d199b85b9de5b30261eadefe12e0fc936bbcd1 GIT binary patch literal 500 zcmV@T4*^jL0KkKSxBkn>;M7G|NsC0N?}25|KL=sFh{@V-|#|!fC>VE5Kt9> z6aXkF+5@lwk%j>(Nrs`I)b$%lrkOGT&}bPAG62v3(007WPsWd|-MnC`nG&BGPfM^W>000>YKrDnJ1!Z%BxyDeekwTydg%FT| z04RVpjSy~xB7BuH)lG!RZBtvO1w@?qgxY(l$SeUN$ZEn7Q5|B2puql}zZ^}G>Lfr& zCtODy!XDRxA3q6|xOk4m#>by0bi0*ULt8Ngb3mgcfwaIBv4~9s0)c~A;|N(1f=ULG z0&@kZ<}nbNkR*wP;6Q}t$gcoR2?bEpu!M{YINT~X_s-ntMJ;oMb z>0m2~*?nymhQ$>|^`xor%vHXvB_k_|L>mPAXM{2(Y?7OZnhrNr{bkLFffhuT$S@%p z0Y*Z|`GCt^geA!%noUc7B$k-!v`L1j_+S+#RV5LeLowfxy;_94RR^Uu_j$QG`?zmB qeY-pL7H(ZBe`sHK1?(6eFyeH@D#&Zim@o?;;_gVN3K9twJiUNjj?b Date: Tue, 7 Jan 2025 11:49:20 +0000 Subject: [PATCH 38/78] First draft completed - cancer First draft completed - cancer, styled and rendered. Prevalence per 1k converted to %. --- R/data.R | 16 ++++++++++++++++ data-raw/healthy-people/cancer.R | 25 ------------------------- data/people_cancer.rda | Bin 0 -> 483 bytes man/people_cancer.Rd | 26 ++++++++++++++++++++++++++ metadata.md | 2 +- 5 files changed, 43 insertions(+), 26 deletions(-) create mode 100644 data/people_cancer.rda create mode 100644 man/people_cancer.Rd diff --git a/R/data.R b/R/data.R index 327711a..f0c5405 100644 --- a/R/data.R +++ b/R/data.R @@ -179,6 +179,22 @@ #' @source \url{https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4} "people_anxiety" +#' Cancer Registrations Percentage (2023-2024) +#' +#' A dataset containing statistics on cancer registration percentages, per +#' Council (2023-2024). +#' +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{cancer_percentage}{Percentage of people with cancer per Council} +#' \item{year}{Time period - Financial year} +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +"people_cancer" + #' Percentage of People Aged 15-64 with Long-Term Health Problem/Disability #' that Limits Daily Activities #' diff --git a/data-raw/healthy-people/cancer.R b/data-raw/healthy-people/cancer.R index 72bff33..e69de29 100644 --- a/data-raw/healthy-people/cancer.R +++ b/data-raw/healthy-people/cancer.R @@ -1,25 +0,0 @@ -library(tidyverse) -library(httr) -library(readODS) - -GET( - "https://www.ninis2.nisra.gov.uk/Download/Health%20and%20Social%20Care/Disease%20Prevalence%20(Quality%20Outcomes%20Framework)%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) - -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "B4:AL15" - ) - -cancer <- - raw |> - as_tibble() |> - select( - lad_code = `LGD2014 Code`, - cancer_per_1000_patients = `Cancer Register: Raw Prevalence per 1,000 patients` - ) - -write_rds(cancer, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/cancer.rds") \ No newline at end of file diff --git a/data/people_cancer.rda b/data/people_cancer.rda new file mode 100644 index 0000000000000000000000000000000000000000..a586d41b3db8727af5413b988994072470254355 GIT binary patch literal 483 zcmV<90UZ89T4*^jL0KkKS@!uRH2?w3|L_0*c>o1T|KP+SkVU`e-{fe5qQF29P!R$m zfFlBdumO>UfRzxZk*WHV(^F4LA7R!E^x1VV^N zK!6lL8pepWq+JOqOK&u2$AZ#~Mg>H#2Tf~{I>qQDJq^G@ExBo^Y7EOakEG_w1ri`6 z6TT==qC^`2L?_K9~_JK}G18IOOk%&zM1qKafu!|-zNkM|H z!$qVqxmg5+HVNxORudRDPQ$4fpjcf}FN|ybp2KvnmrWz)!u0@DNR=aPA~+Xw$WXjU zvPjrSl5Lof+ulqjq+*|I7O!44@cM3_Sbj-x1CD0T|?@3V-Kb=KtB?k~-edTsn1@Qc2NXS(&8C!%Z< Z&`eQcFw@Ie*ff8Oxgwk>NPB#f8h}xL)nEVs literal 0 HcmV?d00001 diff --git a/man/people_cancer.Rd b/man/people_cancer.Rd new file mode 100644 index 0000000..c7d9d99 --- /dev/null +++ b/man/people_cancer.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{people_cancer} +\alias{people_cancer} +\title{Cancer Registrations Percentage (2023-2024)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{cancer_percentage}{Percentage of people with cancer per Council} +\item{year}{Time period - Financial year} +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +people_cancer +} +\description{ +A dataset containing statistics on cancer registration percentages, per +Council (2023-2024). +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 9641652..d168570 100644 --- a/metadata.md +++ b/metadata.md @@ -41,7 +41,7 @@ | Healthy People | Anxiety | 2022-23 | [ONS](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Average personal ratings on feelings of anxiety out of 10. | :heavy_check_mark: | | Healthy People | Life Satisfaction | 2022-23 | [ONS](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Average personal ratings on feelings of life satisfaction out of 10.| :heavy_check_mark: | | Healthy People | Life Worthwhileness | 2022-23 | [ONS](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Average personal ratings on feelings of life worthwhileness out of 10. | :heavy_check_mark: | -| Healthy People | Cancer | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. | :x: | +| Healthy People | Cancer | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage of people with cancer| :heavy_check_mark: | | Healthy People | Cardiovascular Conditions: Atrial Fibrillation | 2021 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :x: This indicator not overtly present in or acting as a substitute for a similar indicator in England's Health Index. To check at the end.| :x: | | Healthy People | Cardiovascular Conditions: CHD | 2021 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :x: This indicator not overtly present in or acting as a substitute for a similar indicator in England's Health Index. To check at the end.| :x: | | Healthy People | Cardiovascular Conditions: Heart Failure | 2021 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :x: This indicator not overtly present in or acting as a substitute for a similar indicator in England's Health Index. To check at the end.| :x: | From 3d3bafae208ae2e032b67876d26fc378a18bef6f Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 7 Jan 2025 12:20:55 +0000 Subject: [PATCH 39/78] First draft completed - dementia First draft completed - dementia, styled and rendered. Prevalence per 1k converted to %. --- R/data.R | 17 +++++++++++++ data-raw/healthy-people/dementia.R | 38 +++++++++++++++-------------- data/people_dementia.rda | Bin 0 -> 480 bytes man/people_dementia.Rd | 28 +++++++++++++++++++++ metadata.md | 2 +- 5 files changed, 66 insertions(+), 19 deletions(-) create mode 100644 data/people_dementia.rda create mode 100644 man/people_dementia.Rd diff --git a/R/data.R b/R/data.R index 327711a..45e08a9 100644 --- a/R/data.R +++ b/R/data.R @@ -179,6 +179,23 @@ #' @source \url{https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4} "people_anxiety" +#' Percentage of People with Dementia +#' +#' A dataset containing statistics on the percentage of people medically +#' diagnosed with dementia, by Council (2023-24). +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{dementia_percentage}{Percentage of people medically diagnosed with +#' dementia, per Council} +#' \item{year}{Time period - Financial year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +"people_dementia" + #' Percentage of People Aged 15-64 with Long-Term Health Problem/Disability #' that Limits Daily Activities #' diff --git a/data-raw/healthy-people/dementia.R b/data-raw/healthy-people/dementia.R index f6ee729..4cd17ab 100644 --- a/data-raw/healthy-people/dementia.R +++ b/data-raw/healthy-people/dementia.R @@ -1,25 +1,27 @@ +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readODS) -GET( - "https://www.ninis2.nisra.gov.uk/Download/Health%20and%20Social%20Care/Disease%20Prevalence%20(Quality%20Outcomes%20Framework)%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) +# ---- Get and clean data ---- +# Dementia Data +# Source: https://data.nisra.gov.uk/ -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "B4:AL15" - ) +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/DISPREVLGD/CSV/1.0/" +dementia_raw <- read_csv(url) -dementia <- - raw |> - as_tibble() |> +people_dementia <- dementia_raw |> + filter( + `Statistic Label` == "Raw disease prevalence per 1,000 patients", + `Disease` == "Dementia", + `Financial Year` == "2023/24", + `LGD2014` != "N92000002" + ) |> + rowwise() |> + mutate(dementia_percentage = VALUE / 10) |> select( - lad_code = `LGD2014 Code`, - dementia_per_1000_patients = `Dementia Register: Raw Prevalence per 1,000 patients2` + ltla24_code = LGD2014, + dementia_percentage, + year = `Financial Year` ) -write_rds(dementia, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/dementia.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(people_dementia, overwrite = TRUE) diff --git a/data/people_dementia.rda b/data/people_dementia.rda new file mode 100644 index 0000000000000000000000000000000000000000..5fe29a88e594e5c3a5a1fbfd1b15fcd572d234c0 GIT binary patch literal 480 zcmV<60U!QCT4*^jL0KkKS#5En9{>Tx|NsB{*#rO(*P z0i!?w0B8UJXaEL+DM)|~27m^D00000000004gjK|2*D%Pu!~tdBvPP50L+ZYfr9{y zz*I^T)t?C4E1x=i84aq*a&ZJRm5QBOq45h4L>6TLWG2zBK%*ERly{#Rrg8~P5dtl7 zB#a>CG!Sh(D6BB?7fTl!oi@2To?$McsS3D3pHw0k0BT4Pgd`atA;Fm-PeCpLSs`;_ z6Q&g$`0yskBaHxZOl0xX^3^%}ZjNjDs!pyzE)=O#SxI(P1Xf}xLZ*t8)6|q|LG>b% zq7r>iZ)|g)c6JU|Y_HF&ZO#1U9&drZ%HOul>MsbVQhI$P3QBlK$x6Qz3e)nk#b*la z^&yKE2Ya7G!39-`0fZ)Y3OtqLLBgmA*3^Y23ov2UNL@2Xj)c!PaIIedSuh;#8pqLb zazzuSyD*^A1qmp03lc5XFQ($ZgCbf5xv#Q)*SI$fvKx0Gv}L^))Cc(-3_^g30RbE& WQN9`z)?Nc8(RU Date: Tue, 7 Jan 2025 13:14:22 +0000 Subject: [PATCH 40/78] First draft completed - household-overcrowding First draft completed - household-overcrowding, styled and rendered. --- R/data.R | 19 +++++++++++ .../healthy-places/household-overcrowding.R | 31 ++++++++---------- data/places_household_overcrowding.rda | Bin 0 -> 324 bytes man/places_household_overcrowding.Rd | 30 +++++++++++++++++ metadata.md | 2 +- 5 files changed, 63 insertions(+), 19 deletions(-) create mode 100644 data/places_household_overcrowding.rda create mode 100644 man/places_household_overcrowding.Rd diff --git a/R/data.R b/R/data.R index 327711a..f1746cd 100644 --- a/R/data.R +++ b/R/data.R @@ -267,6 +267,25 @@ #' @source \url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} "people_mental_health" +#' Percentage Household Overcrowding (2017) +#' +#' A dataset containing statistics on the percentage of households experiencing +#' household overcrowding, per Council (2017). +#' Household overcrowding is typically defined as households with an occupancy +#' rating of -1 or lower. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{household_overcrowding_percentage}{Percentage of households +#' experiencing household overcrowding} +#' \item{year}{Year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +"places_household_overcrowding" + #' Rates of Personal Crime per 1,000 (2017) #' #' A dataset containing statistics on 'personal crime' per 1,000 people in diff --git a/data-raw/healthy-places/household-overcrowding.R b/data-raw/healthy-places/household-overcrowding.R index 95d1d5a..415ab18 100644 --- a/data-raw/healthy-places/household-overcrowding.R +++ b/data-raw/healthy-places/household-overcrowding.R @@ -1,25 +1,20 @@ +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readODS) -GET( - "https://www.ninis2.nisra.gov.uk/Download/Deprivation/Northern%20Ireland%20Multiple%20Deprivation%20Measure%202017%20-%20Indicators%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) +# ---- Get and clean data ---- +# Household Overcrowding Data +# Source: https://data.nisra.gov.uk/ -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "B4:AM15" - ) +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/NIMDM17T10/CSV/1.0/" +overcrowding_raw <- read_csv(url) -overcrowding <- - raw |> - as_tibble() |> +places_household_overcrowding <- overcrowding_raw |> + filter(`Statistic Label` == "Rate of Household overcrowding") |> select( - lad_code = `LGD2014 Code`, - overcrowding_rate = `Rate of Household overcrowding\n(%)` + ltla24_code = LGD2014, + household_overcrowding_percentage = VALUE, + year = `Ad-hoc year` ) -write_rds(overcrowding, "data/vulnerability/health-inequalities/northern-ireland/healthy-places/household-overcrowding.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(places_household_overcrowding, overwrite = TRUE) diff --git a/data/places_household_overcrowding.rda b/data/places_household_overcrowding.rda new file mode 100644 index 0000000000000000000000000000000000000000..84e11bb16ec99d681347ae944e94bf729fe69f6f GIT binary patch literal 324 zcmV-K0lWS}T4*^jL0KkKSz(#2#Q*^H|K$HaT>>Bhf8ay`5J11@-=IVQ05E_C0s*iA z8j%Sp0Vk=jp#4+S$kF9JN2%oiGBRnjo+vqh0%X7fVK7V~fFl425=2Aw2BSd8!5IJm z&<01O`Vlvhkf21}y}F59n^451Q5r9@#E!cD_EJ=_db1slAWPpPNNlH~Udp?BtM9We zsN9lep@^jjUlq9vC-TW- WGS^*z*Xl9 Date: Tue, 7 Jan 2025 15:05:49 +0000 Subject: [PATCH 41/78] Updated metadata - musculoskeletal conditions Updated metadata - musculoskeletal conditions. Data unavailable. Merged previously separated osteoporosis and rheumatoid arthritis into one musculoskeletal conditions indicator --- metadata.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/metadata.md b/metadata.md index 9641652..06e5d0a 100644 --- a/metadata.md +++ b/metadata.md @@ -50,8 +50,7 @@ | Healthy People | Dementia | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index.| :x: | | Healthy People | Diabetes | ? | [NISRA](https://datavis.nisra.gov.uk/dissemination/NINIS-redirect.html) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data currently unavailable. Raw disease prevalence only shows data per 1,000 (England's Health Index uses %). Other alternative could be 'Prescriptions for drugs used to treat Diabetes (administrative geographies) (4), but need to contact info.bso@hscni.net to check. Review at the end. | :x: | | Healthy People | Kidney and Liver Disease | :x: | :x: | :x: | :x: Data unavailable. | :x: | -| Healthy People | Musculoskeletal Conditions: Osteoporosis | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. Musculoskeletal Conditions is treated as 1 indicator. | :x: | -| Healthy People | Musculoskeletal Conditions: Rheumatoid Arthritis | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. Musculoskeletal Conditions is treated as 1 indicator.| :x: | +| Healthy People | Musculoskeletal Conditions | :x: | :x: | :x: | :x: No data available | :x: | | Healthy People | Respiratory Conditions: Asthma | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. Respiratory Conditions is treated as 1 indicator. | :x: | | Healthy People | Respiratory Conditions: COPD | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. Respiratory Conditions is treated as 1 indicator. | :x: | | Healthy Places | Private Outdoor Space | :x: | :x: | :x: | :x: Data unavailable. | :x: | From 82d7906c758cc03edd3f1940617600bb4916e85a Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 7 Jan 2025 16:04:27 +0000 Subject: [PATCH 42/78] First draft completed - respiratory-conditions First draft completed - respiratory-conditions, styled and rendered. Prevalence per 1k converted to %. --- R/data.R | 18 +++++++++ .../healthy-people/respiratory-conditions.R | 37 ++++++++++++++++++ data/people_respiratory_conditions.rda | Bin 0 -> 392 bytes man/people_respiratory_conditions.Rd | 28 +++++++++++++ metadata.md | 3 +- 5 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 data-raw/healthy-people/respiratory-conditions.R create mode 100644 data/people_respiratory_conditions.rda create mode 100644 man/people_respiratory_conditions.Rd diff --git a/R/data.R b/R/data.R index 327711a..09e218f 100644 --- a/R/data.R +++ b/R/data.R @@ -267,6 +267,24 @@ #' @source \url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} "people_mental_health" +#' Percentage Rate of Respiratory Conditions (Asthma and COPD) (2023/2024) +#' +#' A dataset containing statistics on the percentage of people who self-reported +#' as having asthma and/or COPD in Northern Irish Council Areas. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authroity Code} +#' \item{respiratory_conditions_percentage}{Percentage of people who self-reported +#' as having asthma and/or COPD} +#' \item{year}{Time period - financial year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +#' +"people_respiratory_conditions" + #' Rates of Personal Crime per 1,000 (2017) #' #' A dataset containing statistics on 'personal crime' per 1,000 people in diff --git a/data-raw/healthy-people/respiratory-conditions.R b/data-raw/healthy-people/respiratory-conditions.R new file mode 100644 index 0000000..7f6e9ad --- /dev/null +++ b/data-raw/healthy-people/respiratory-conditions.R @@ -0,0 +1,37 @@ +# Respiratory conditions here pertains to asthma and COPD data. A mean average +# has been calculated between the 2 to get an average for respiratory conditions. +# This best matches how England's Health Index calculates their respiratory +# conditions indicator. + +# ---- Load packages ---- +library(tidyverse) + +# ---- Get and clean data ---- +# Respiratory Conditions +# Source: https://data.nisra.gov.uk/ + +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/DISPREVLGD/CSV/1.0/" +respiratory_conditions_raw <- read_csv(url) + +people_respiratory_conditions <- respiratory_conditions_raw |> + filter( + `Statistic Label` == "Raw disease prevalence per 1,000 patients", + `Financial Year` == "2023/24", + `Disease` %in% c("Asthma", "Chronic Obstructive Pulmonary Disease"), + `LGD2014` != "N92000002" + ) |> + group_by(LGD2014) |> + mutate( + respiratory_conditions_prevalence = mean(VALUE, na.rm = TRUE), + respiratory_conditions_percentage = (respiratory_conditions_prevalence / 10) + ) |> + ungroup() |> + distinct(LGD2014, .keep_all = TRUE) |> + select( + ltla24_code = LGD2014, + respiratory_conditions_percentage, + year = `Financial Year` + ) + +# ---- Save output to data/ folder ---- +usethis::use_data(people_respiratory_conditions, overwrite = TRUE) diff --git a/data/people_respiratory_conditions.rda b/data/people_respiratory_conditions.rda new file mode 100644 index 0000000000000000000000000000000000000000..bc803718e5bae33b00c5be23101bff0353bb521c GIT binary patch literal 392 zcmV;30eAjFT4*^jL0KkKSr5y%ga833fB*lx{nH=`|L8h(JH5HsJOo z;mUn(?n4TZL_z`!r}D$=IjNEqYquc!wWAoyj2;!c*pnn%i6eJhF-KHsTsLtkcIHkX zA0#D9Wf#%5Rv|s9R9lFuS=x|8HN&6ozG%o5Kv3ay`el?JJYS|*7&po{j{5w$`Z$jU m2Cthy*X9&hd$MWMz5O+()4zTk7oP*)#oUoj6eI)k?co3qw4M?G literal 0 HcmV?d00001 diff --git a/man/people_respiratory_conditions.Rd b/man/people_respiratory_conditions.Rd new file mode 100644 index 0000000..610bd38 --- /dev/null +++ b/man/people_respiratory_conditions.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{people_respiratory_conditions} +\alias{people_respiratory_conditions} +\title{Percentage Rate of Respiratory Conditions (Asthma and COPD) (2023/2024)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authroity Code} +\item{respiratory_conditions_percentage}{Percentage of people who self-reported +as having asthma and/or COPD} +\item{year}{Time period - financial year} + +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +people_respiratory_conditions +} +\description{ +A dataset containing statistics on the percentage of people who self-reported +as having asthma and/or COPD in Northern Irish Council Areas. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 06e5d0a..59ccfe0 100644 --- a/metadata.md +++ b/metadata.md @@ -51,8 +51,7 @@ | Healthy People | Diabetes | ? | [NISRA](https://datavis.nisra.gov.uk/dissemination/NINIS-redirect.html) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data currently unavailable. Raw disease prevalence only shows data per 1,000 (England's Health Index uses %). Other alternative could be 'Prescriptions for drugs used to treat Diabetes (administrative geographies) (4), but need to contact info.bso@hscni.net to check. Review at the end. | :x: | | Healthy People | Kidney and Liver Disease | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy People | Musculoskeletal Conditions | :x: | :x: | :x: | :x: No data available | :x: | -| Healthy People | Respiratory Conditions: Asthma | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. Respiratory Conditions is treated as 1 indicator. | :x: | -| Healthy People | Respiratory Conditions: COPD | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. Respiratory Conditions is treated as 1 indicator. | :x: | +| Healthy People | Respiratory Conditions: Asthma & COPD | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage rate of people self-reported as having asthma and/or COPD. | :heavy_check_mark: | | Healthy Places | Private Outdoor Space | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Places | Public Green Space | :x: | :x: | :x: | :heavy_exclamation_mark: Indicator not overtly present in England's Health Index. To review at the end. | :x: | | Healthy Places | Household Overcrowding | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index.| :x: | From a3d829ece7599d0103cc868f73718818fb452be0 Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 7 Jan 2025 16:53:37 +0000 Subject: [PATCH 43/78] First draft completed - cardiovascular-conditions First draft completed - cardiovascular-conditions, styled and rendered. Prevalence per 1k converted to %. --- R/data.R | 20 +++++++++ .../cardiovascular-conditions.R | 38 ++++++++++++++++++ data/people_cardiovascular_conditions.rda | Bin 0 -> 410 bytes man/people_cardiovascular_conditions.Rd | 30 ++++++++++++++ metadata.md | 2 +- 5 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 data-raw/healthy-people/cardiovascular-conditions.R create mode 100644 data/people_cardiovascular_conditions.rda create mode 100644 man/people_cardiovascular_conditions.Rd diff --git a/R/data.R b/R/data.R index 327711a..36f58b0 100644 --- a/R/data.R +++ b/R/data.R @@ -179,6 +179,26 @@ #' @source \url{https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4} "people_anxiety" +#' Percentage Rate of Cardiovascular Conditions (CHD, Atrial Fibrillation, +#' Heart Failure, Stroke & TIA) (2023/2024) +#' +#' A dataset containing statistics on the percentage of people who self-reported +#' as having CHD, Atrial Fibrillation, Heart Failure, and/or Stroke & TIA in +#' Northern Irish Council Areas. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authroity Code} +#' \item{cardiovascular_conditions_percentage}{Percentage of people who self-reported +#' as having CHD, Atrial Fibrillation, Heart Failure, and/or Stroke & TIA} +#' \item{year}{Time period - financial year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +#' +"people_cardiovascular_conditions" + #' Percentage of People Aged 15-64 with Long-Term Health Problem/Disability #' that Limits Daily Activities #' diff --git a/data-raw/healthy-people/cardiovascular-conditions.R b/data-raw/healthy-people/cardiovascular-conditions.R new file mode 100644 index 0000000..b320ecc --- /dev/null +++ b/data-raw/healthy-people/cardiovascular-conditions.R @@ -0,0 +1,38 @@ +# Cardiovascular conditions here pertains to CHD, Atrial Fibrillation, Heart +# Failure, and Stroke & TIA data. A mean average has been calculated between the +# 5 to get an average for cardiovascular conditions. This best matches how +# England's Health Index calculates their cardiovascular conditions indicator. + +# ---- Load packages ---- +library(tidyverse) + +# ---- Get and clean data ---- +# Cardiovascular Conditions Data (CHD, Atrial Fibrillation, Heart Failure, Stroke & TIA) +# Source: https://data.nisra.gov.uk/ + +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/DISPREVLGD/CSV/1.0/" +cardiovascular_conditions_raw <- read_csv(url) + +people_cardiovascular_conditions <- cardiovascular_conditions_raw |> + filter( + `Statistic Label` == "Raw disease prevalence per 1,000 patients", + `Financial Year` == "2023/24", + `Disease` %in% c("Atrial Fibrillation", "Coronary Heart Disease", + "Heart Failure 1", "Heart Failure 3", "Stroke & TIA"), + `LGD2014` != "N92000002" + ) |> + group_by(LGD2014) |> + mutate( + cardiovascular_conditions_prevalence = mean(VALUE, na.rm = TRUE), + cardiovascular_conditions_percentage = (cardiovascular_conditions_prevalence / 10) + ) |> + ungroup() |> + distinct(LGD2014, .keep_all = TRUE) |> + select( + ltla24_code = LGD2014, + cardiovascular_conditions_percentage, + year = `Financial Year` + ) + +# ---- Save output to data/ folder ---- +usethis::use_data(people_cardiovascular_conditions, overwrite = TRUE) diff --git a/data/people_cardiovascular_conditions.rda b/data/people_cardiovascular_conditions.rda new file mode 100644 index 0000000000000000000000000000000000000000..9acdc92ff0958581c2f71f298db8d9f03e98a313 GIT binary patch literal 410 zcmV;L0cHL|T4*^jL0KkKS#qnQod5wPfB*lxTnI!Z|L4wu5Y4~m-=x40AQ1=&Ap*e& z6zByCf}gMfHa1ZbQRy%f(KA3bH1!!7JrhBLN$N2TJf_f3Nr=HbDA-R>N{u5)wNFhz z&;S4c00w{n10c;ur~otxB#LRKH5xQD4Kit_ng9R|8fX9j22B6}K!&QWGAWA%DG1YY z)nY!gPNyu@53Cx$o6YtBrB8;?hX_QP6J2G0Iu-={8WFZ2b&PPlWR#!*kSOLjzhCB6A66){yc<_%eClD%RKIx=6c_fF&eAk*1LRn4?+aBtuBdNR3@!Br`X` z0<=dEgafVGJ8G4n@8h*FWh<(%;3A9z#2`H)(pa0-PkI&5``}wUM!aLz&!+ zR7G_rK1NdRif@HvgHP7c&-0u-5(y~hV$4)F72#YaBLDeZp;AcAR-(nKr{SZ$rRy2LCUU* EbevzW<^TWy literal 0 HcmV?d00001 diff --git a/man/people_cardiovascular_conditions.Rd b/man/people_cardiovascular_conditions.Rd new file mode 100644 index 0000000..31090be --- /dev/null +++ b/man/people_cardiovascular_conditions.Rd @@ -0,0 +1,30 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{people_cardiovascular_conditions} +\alias{people_cardiovascular_conditions} +\title{Percentage Rate of Cardiovascular Conditions (CHD, Atrial Fibrillation, +Heart Failure, Stroke & TIA) (2023/2024)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authroity Code} +\item{cardiovascular_conditions_percentage}{Percentage of people who self-reported +as having CHD, Atrial Fibrillation, Heart Failure, and/or Stroke & TIA} +\item{year}{Time period - financial year} + +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +people_cardiovascular_conditions +} +\description{ +A dataset containing statistics on the percentage of people who self-reported +as having CHD, Atrial Fibrillation, Heart Failure, and/or Stroke & TIA in +Northern Irish Council Areas. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 06e5d0a..78f7ba8 100644 --- a/metadata.md +++ b/metadata.md @@ -13,7 +13,7 @@ | Healthy Lives | GCSE Achievement | 2022-23 | [NISRA](https://data.nisra.gov.uk/) | [NISRA](https://data.nisra.gov.uk/) | :heavy_check_mark: Indicator: Percentage of GSCE attainment, including Maths and English (Grades A-C) | :heavy_check_mark: | | Healthy Lives | Young People's Education, Employment and Training | 2018 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Lives | Child Poverty | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Percentage of children (aged 15 and under) living in absolute low income families | :heavy_check_mark: | -| Healthy Lives |Cardiovascular Conditions | 2023/24 | [NISRA](https://data.nisra.gov.uk/k) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data only available as separate conditions (CHD, COPD, Heart Failure 1 & 3, Stroke and TIA) as a rate per 1,000. To be comparable to England's Index must be shown as a %. To review at the end. | :x: | +| Healthy Lives |Cardiovascular Conditions | 2023/24 | [NISRA](https://data.nisra.gov.uk/k) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage rate of people self-reported as having CHD, Atrial Fibrillation, Heart Failure, and/or Stroke & TIA. | :heavy_check_mark: | | Healthy Lives | High Blood Pressure | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. | :x: | | Healthy Lives | Overweight and Obesity in Adults | :x: | :x: | :x: | :x: - Data unavailable. | :x: | | Healthy Lives | Cancer Screening | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | :x:| ❗: - The data (breast, bowel, and cervical cancers) is at the Health and Social Care Trusts level | :x: | From 6994d2b02986cd0d23fc098bb04b968f9eb728e4 Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 8 Jan 2025 08:42:11 +0000 Subject: [PATCH 44/78] Updated metadata for alcohol and drug misuse Updated metadata for alcohol and drug misuse. only absolute numbers for trust available. Will need to calculate per 100k of each trust --- metadata.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.md b/metadata.md index 06e5d0a..569ec00 100644 --- a/metadata.md +++ b/metadata.md @@ -2,8 +2,8 @@ | Domain | Indicator | Year | Source | License | Indicator Code Added to `R/` | Data Added to `data/` | | --- | --- | --- | --- | --- | --- | --- | -| Healthy Lives | Alcohol Misuse | 2019 | [Census of drug and alcohol treatment services in Northern Ireland](https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | -| Healthy Lives | Drug Misuse | 2019 | [Census of drug and alcohol treatment services in Northern Ireland](https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | +| Healthy Lives | Alcohol Misuse | 2019 | [Census of drug and alcohol treatment services in Northern Ireland](https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level and is an absolute number. Will need to calculate compared to whoe population for a per 100k number. | :x: | +| Healthy Lives | Drug Misuse | 2019 | [Census of drug and alcohol treatment services in Northern Ireland](https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level and is an absolute number. Will need to calculate compared to whoe population for a per 100k number. | :x: | | Healthy Lives | Healthy Eating | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | | Healthy Lives | Physical Activity | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x:| :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | | Healthy Lives | Sedentary Behaviour | :x: | :x: | :x:| :x: - Data unavailable | :x: | From 4830172dc4df7a51184f25701d993ca3b4a279dd Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 8 Jan 2025 09:47:31 +0000 Subject: [PATCH 45/78] First draft - healthy-eating First draft - healthy-eating. Gathered trust and LA codes, ready to join into one data set. --- data-raw/healthy-lives/healthy-eating.R | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 data-raw/healthy-lives/healthy-eating.R diff --git a/data-raw/healthy-lives/healthy-eating.R b/data-raw/healthy-lives/healthy-eating.R new file mode 100644 index 0000000..0536a9c --- /dev/null +++ b/data-raw/healthy-lives/healthy-eating.R @@ -0,0 +1,48 @@ +# ---- Load packages ---- +library(tidyverse) +library(readxl) +library(httr) +library(geographr) +library(ggplot2) + +# ---- Get and clean data ---- +# Healthy Eating Data +# Source: https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223 + +GET("https://www.health-ni.gov.uk/sites/default/files/publications/health/hsni-trend-tables-22-23.xlsx", + write_disk(tf <- tempfile(fileext = ".xlsx"))) + +healthy_eating_raw <- read_excel(tf, sheet = 17, skip = 160) + +healthy_eating_hb <- healthy_eating_raw |> + slice(2:6) |> + select(hb24_name = `All`, + healthy_eating_percentage = `2022/23...14`) + + +# Geographical Code Data: Health Board and Local Authority + +hb_ltla_lookup <- lookup_ltla21_hsct18 |> + distinct(ltla21_code, trust18_code) + +hb_lookup <- boundaries_trusts_ni18 |> + sf::st_drop_geometry() + + +# Join datasets +# Healthy eating data + Trust name and code + +healthy_eating_hb <- healthy_eating_hb |> + select(trust18_name = hb24_name, + healthy_eating_percentage) |> + left_join(hb_lookup, by = "trust18_name") |> + select(-trust18_name) |> + relocate(trust18_code) + +# Healthy eating data + LA code + +lives_healthy_eating <- healthy_eating_hb |> + left_join(hb_ltla_lookup, by = + + + From 72e437d178e40c7b8c76c26276c49e4414583681 Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 8 Jan 2025 09:58:08 +0000 Subject: [PATCH 46/78] First draft completed - healthy-eating First draft completed - healthy-eating, styled and rendered. Converted from HB to LA level. --- R/data.R | 19 +++++++++++++ data-raw/healthy-lives/healthy-eating.R | 34 ++++++++++++++++-------- data/lives_healthy_eating.rda | Bin 0 -> 347 bytes man/lives_healthy_eating.Rd | 28 +++++++++++++++++++ metadata.md | 2 +- 5 files changed, 71 insertions(+), 12 deletions(-) create mode 100644 data/lives_healthy_eating.rda create mode 100644 man/lives_healthy_eating.Rd diff --git a/R/data.R b/R/data.R index 327711a..3480d24 100644 --- a/R/data.R +++ b/R/data.R @@ -35,6 +35,25 @@ #' "lives_gsce_attainment" +#' Percentage of People that Eat Healthy (2022-2023) +#' +#' A dataset containing statistics on fruit and vegetable consumption in +#' each Northern Irish Council, 2022-23. +#' +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{healthy_eating_percentage}{Percentage of people that consume +#' 5 portions or more of fruit and vegetable per day} +#' \item{year}{Time period} +#' +#' ... +#' } +#' @source \url{https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223} +#' +"lives_healthy_eating" + #' Percentage of Babies Born Not at a Healthy Birth Weight (2022-2023) #' #' A dataset containing percentage babies born not at a healthy birth weight. diff --git a/data-raw/healthy-lives/healthy-eating.R b/data-raw/healthy-lives/healthy-eating.R index 0536a9c..6fbb69d 100644 --- a/data-raw/healthy-lives/healthy-eating.R +++ b/data-raw/healthy-lives/healthy-eating.R @@ -3,21 +3,24 @@ library(tidyverse) library(readxl) library(httr) library(geographr) -library(ggplot2) # ---- Get and clean data ---- # Healthy Eating Data # Source: https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223 -GET("https://www.health-ni.gov.uk/sites/default/files/publications/health/hsni-trend-tables-22-23.xlsx", - write_disk(tf <- tempfile(fileext = ".xlsx"))) +GET( + "https://www.health-ni.gov.uk/sites/default/files/publications/health/hsni-trend-tables-22-23.xlsx", + write_disk(tf <- tempfile(fileext = ".xlsx")) +) healthy_eating_raw <- read_excel(tf, sheet = 17, skip = 160) healthy_eating_hb <- healthy_eating_raw |> slice(2:6) |> - select(hb24_name = `All`, - healthy_eating_percentage = `2022/23...14`) + select( + hb24_name = `All`, + healthy_eating_percentage = `2022/23...14` + ) # Geographical Code Data: Health Board and Local Authority @@ -33,8 +36,10 @@ hb_lookup <- boundaries_trusts_ni18 |> # Healthy eating data + Trust name and code healthy_eating_hb <- healthy_eating_hb |> - select(trust18_name = hb24_name, - healthy_eating_percentage) |> + select( + trust18_name = hb24_name, + healthy_eating_percentage + ) |> left_join(hb_lookup, by = "trust18_name") |> select(-trust18_name) |> relocate(trust18_code) @@ -42,7 +47,14 @@ healthy_eating_hb <- healthy_eating_hb |> # Healthy eating data + LA code lives_healthy_eating <- healthy_eating_hb |> - left_join(hb_ltla_lookup, by = - - - + left_join(hb_ltla_lookup, by = "trust18_code") |> + mutate(year = "2022/23") |> + select( + ltla24_code = ltla21_code, + healthy_eating_percentage, + year + ) |> + arrange(ltla24_code) + +# ---- Save output to data/ folder ---- +usethis::use_data(lives_healthy_eating, overwrite = TRUE) diff --git a/data/lives_healthy_eating.rda b/data/lives_healthy_eating.rda new file mode 100644 index 0000000000000000000000000000000000000000..1116dc73996933bb4b3e8796d73d861ccc899e1c GIT binary patch literal 347 zcmV-h0i^yyT4*^jL0KkKS&Vje`v3u`f588`OdtRO|KJ1x5J11@-Jn1K0s*iAT7d?M zPbuh`q+}X2+Kn;*88poxzyLG=22B6}27pNvz)`7*gaByB)6@Vm94m_Z%yeK$(|j#Z z(*!RL8}CGzFm4t5xgZZm)lpC2nHA{Ulo1fmioIk__mA#qX3)|3=jsT5-~1&IXdASMtdSg`_iqcp<93=$z2 zxl$zw7ZnSM)gokINT^}0BVODo*TCDed>dJ_@OXT=5=m#>Tr t?g)j;78zvGfR%EwcB!W^goy0IK#*|lm|OSvz+nH2xgwk>NJcw5eSiTAi~Ilp literal 0 HcmV?d00001 diff --git a/man/lives_healthy_eating.Rd b/man/lives_healthy_eating.Rd new file mode 100644 index 0000000..e6dce41 --- /dev/null +++ b/man/lives_healthy_eating.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{lives_healthy_eating} +\alias{lives_healthy_eating} +\title{Percentage of People that Eat Healthy (2022-2023)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{healthy_eating_percentage}{Percentage of people that consume +5 portions or more of fruit and vegetable per day} +\item{year}{Time period} + +... +} +} +\source{ +\url{https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223} +} +\usage{ +lives_healthy_eating +} +\description{ +A dataset containing statistics on fruit and vegetable consumption in +each Northern Irish Council, 2022-23. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 569ec00..94e6ba9 100644 --- a/metadata.md +++ b/metadata.md @@ -4,7 +4,7 @@ | --- | --- | --- | --- | --- | --- | --- | | Healthy Lives | Alcohol Misuse | 2019 | [Census of drug and alcohol treatment services in Northern Ireland](https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level and is an absolute number. Will need to calculate compared to whoe population for a per 100k number. | :x: | | Healthy Lives | Drug Misuse | 2019 | [Census of drug and alcohol treatment services in Northern Ireland](https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level and is an absolute number. Will need to calculate compared to whoe population for a per 100k number. | :x: | -| Healthy Lives | Healthy Eating | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | +| Healthy Lives | Healthy Eating | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage of People that consume 5 or more fruit and vegetable portions per day | :heavy_check_mark: | | Healthy Lives | Physical Activity | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x:| :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | | Healthy Lives | Sedentary Behaviour | :x: | :x: | :x:| :x: - Data unavailable | :x: | | Healthy Lives | Smoking | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | From a9139b064a0204b78b97b00705405c3ff545769d Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 8 Jan 2025 10:30:46 +0000 Subject: [PATCH 47/78] Updated metadata - physical activity Updated metadata - physical activity. Data not collected --- metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.md b/metadata.md index 569ec00..63f9025 100644 --- a/metadata.md +++ b/metadata.md @@ -5,7 +5,7 @@ | Healthy Lives | Alcohol Misuse | 2019 | [Census of drug and alcohol treatment services in Northern Ireland](https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level and is an absolute number. Will need to calculate compared to whoe population for a per 100k number. | :x: | | Healthy Lives | Drug Misuse | 2019 | [Census of drug and alcohol treatment services in Northern Ireland](https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level and is an absolute number. Will need to calculate compared to whoe population for a per 100k number. | :x: | | Healthy Lives | Healthy Eating | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | -| Healthy Lives | Physical Activity | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x:| :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | +| Healthy Lives | Physical Activity | :x: | :x: | :x:| :x: Data not collected. | :x: | | Healthy Lives | Sedentary Behaviour | :x: | :x: | :x:| :x: - Data unavailable | :x: | | Healthy Lives | Smoking | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | | Healthy Lives | Early Years Development | NA | [NISRA](https://datavis.nisra.gov.uk/dissemination/NINIS-redirect.html) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data unavailable - contact statistics@education-ni.gov.uk | :x: | From 22fa6ccce7693139bc554016ae4769432655fa78 Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 8 Jan 2025 10:54:47 +0000 Subject: [PATCH 48/78] First draft started - smoking First draft started - smoking. Still to combine with LA codes --- data-raw/healthy-lives/smoking.R | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 data-raw/healthy-lives/smoking.R diff --git a/data-raw/healthy-lives/smoking.R b/data-raw/healthy-lives/smoking.R new file mode 100644 index 0000000..ced7f35 --- /dev/null +++ b/data-raw/healthy-lives/smoking.R @@ -0,0 +1,41 @@ +# ---- Load packages ---- +library(tidyverse) +library(readxl) +library(httr) +library(geographr) + +# ---- Get and clean data ---- +# Geographical Code Data: Health Board and Local Authority + +hb_ltla_lookup <- lookup_ltla21_hsct18 |> + distinct(ltla21_code, trust18_code) + +hb_lookup <- boundaries_trusts_ni18 |> + sf::st_drop_geometry() + + +# Healthy Eating Data +# Source: https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223 + +GET( + "https://www.health-ni.gov.uk/sites/default/files/publications/health/hsni-trend-tables-22-23.xlsx", + write_disk(tf <- tempfile(fileext = ".xlsx")) +) + +smoking_raw <- read_excel(tf, sheet = 19, skip = 166) + +smoking_hb <- smoking_raw |> + slice(2:6) |> + select(trust18_name = `All`, + smoking_percentage = `2022/23...14`) + +# Join datasets +# Smoking data + Trust name and code + +smoking_hb <- smoking_hb |> + left_join(hb_lookup) |> + select(-trust18_name) |> + relocate(trust18_code) + +# Smoking data + LA code + From 4fa2a8ac1b60565524f818670e72d86a045b6ca7 Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 8 Jan 2025 12:19:27 +0000 Subject: [PATCH 49/78] Fist draft completed - smoking Fist draft completed - smoking, styled and rendered. Converted from HB to LA. --- R/data.R | 17 +++++++++++++++++ data-raw/healthy-lives/smoking.R | 19 ++++++++++++++++--- data/lives_smoking.rda | Bin 0 -> 345 bytes man/lives_smoking.Rd | 27 +++++++++++++++++++++++++++ metadata.md | 2 +- 5 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 data/lives_smoking.rda create mode 100644 man/lives_smoking.Rd diff --git a/R/data.R b/R/data.R index 327711a..9e7075f 100644 --- a/R/data.R +++ b/R/data.R @@ -87,6 +87,23 @@ #' "lives_pupil_absence" +#' Percentage of Current Smokers (2022-2023) +#' +#' A dataset containing statistics on smoking status in +#' each Northern Irish Council, 2022-23. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{smoking_percentage}{Percentage of people that are current smokers} +#' \item{year}{Time period} +#' +#' ... +#' } +#' @source \url{https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223} +#' +"lives_smoking" + #' Rates of teenage pregnancies per 1,000 (2020-22) #' #' A dataset containing statistics on the rate of teenage pregnancies per 1k. diff --git a/data-raw/healthy-lives/smoking.R b/data-raw/healthy-lives/smoking.R index ced7f35..0ba0ce5 100644 --- a/data-raw/healthy-lives/smoking.R +++ b/data-raw/healthy-lives/smoking.R @@ -26,8 +26,10 @@ smoking_raw <- read_excel(tf, sheet = 19, skip = 166) smoking_hb <- smoking_raw |> slice(2:6) |> - select(trust18_name = `All`, - smoking_percentage = `2022/23...14`) + select( + trust18_name = `All`, + smoking_percentage = `2022/23...14` + ) # Join datasets # Smoking data + Trust name and code @@ -38,4 +40,15 @@ smoking_hb <- smoking_hb |> relocate(trust18_code) # Smoking data + LA code - +lives_smoking <- smoking_hb |> + left_join(hb_ltla_lookup) |> + mutate(year = "2022/23") |> + select( + ltla24_code = ltla21_code, + smoking_percentage, + year + ) |> + arrange(ltla24_code) + +# ---- Save output to data/ folder ---- +usethis::use_data(lives_smoking, overwrite = TRUE) diff --git a/data/lives_smoking.rda b/data/lives_smoking.rda new file mode 100644 index 0000000000000000000000000000000000000000..7204e69be8051a4e8cffb2dbace28f28f44ac909 GIT binary patch literal 345 zcmV-f0jB;!T4*^jL0KkKSy@Br8UO*Pf588`SO5S4|KJ1x5J11L-Jn1K0s*iAT7d?U zN2KzbO-zg+^oD={W~TK)jSUR|84Umc000t50+>mo)CP?jY3ga}28|gG3fXdI*ZLAch1Q z21$@O9G=c$2`#a56|9jYjJQQ32qbDqVIstgIl@U85FBzmCFqe=h2CRV129S;FwQI| zVWJ5bq+VPT86u&1wIX3IS%jESCNf2ghY%!nk{mir5h6e>91b6xr0D}ar3wW{g-V5L zNPFT=0a6nv8Hx&HMowgis1F`xts`DJU#rK<_3g8HvKyjDx0b;$YR>D_4O}G_7@9$N r%Gi5ZQX`zjOPEzlEs5xj0Y?y@;n3 Date: Wed, 8 Jan 2025 14:05:51 +0000 Subject: [PATCH 50/78] First draft completed - infant-mortality First draft completed - infant-mortality, styled and rendered. Converted HB to LA. --- R/data.R | 17 ++ data-raw/healthy-lives/infant-mortality.R | 219 ++++------------------ data/lives_infant_mortality.rda | Bin 0 -> 303 bytes man/lives_infant_mortality.Rd | 28 +++ metadata.md | 2 +- 5 files changed, 78 insertions(+), 188 deletions(-) create mode 100644 data/lives_infant_mortality.rda create mode 100644 man/lives_infant_mortality.Rd diff --git a/R/data.R b/R/data.R index 327711a..eae761c 100644 --- a/R/data.R +++ b/R/data.R @@ -69,6 +69,23 @@ #' "lives_childhood_overweight_obesity" +#' Rate of infant mortality (2018-2022) +#' +#' A dataset containing statistics on the rate of infant mortality in each +#' Norther Irish Council, 2018-2022. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{infant_mortality_per_1k}{Rate of infants per 1,000 that have died +#' under the age of 1} +#' \item{year}{Time period - five year aggregate} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +"lives_infant_mortality" + #' Percentage of Pupil Absences (2021/22) #' #' A dataset containing statistics on the percentage of unauthorised school diff --git a/data-raw/healthy-lives/infant-mortality.R b/data-raw/healthy-lives/infant-mortality.R index ea93afa..e2bb670 100644 --- a/data-raw/healthy-lives/infant-mortality.R +++ b/data-raw/healthy-lives/infant-mortality.R @@ -1,209 +1,54 @@ -# ---- Load ---- +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readxl) library(geographr) -library(sf) -source("R/utils.R") +# ---- Get and clean data ---- +# Geographical Code Data: Health Board and Local Authority -ni_lookup <- - boundaries_lad |> - st_drop_geometry() |> - filter_codes(lad_code, "^N") |> - select(lad_name, lad_code) +hb_ltla_lookup <- lookup_ltla21_hsct18 |> + distinct(ltla21_code, trust18_code) -# ---- Load Latest 3 year birth & death rates ---- -GET( - "https://www.nisra.gov.uk/sites/nisra.gov.uk/files/publications/RG_2017.zip", - write_disk(tf <- tempfile(fileext = ".zip")) -) +hb_lookup <- boundaries_trusts_ni18 |> + sf::st_drop_geometry() -unzip(tf, exdir = tempdir()) -raw_infant_deaths_2017 <- - read_excel( - list.files( - tempdir(), - pattern = "Stillbirths_InfantDeaths_2017.xls", - full.names = TRUE - ), - sheet = "Table 4.4b", - range = "A4:C53" - ) +# Infant Mortality Data +# Source: https://data.nisra.gov.uk/ -infant_deaths_2017 <- - raw_infant_deaths_2017 |> - slice(-c(1:6)) |> - drop_na() |> - select( - lad_name = `...1`, - infant_mortality_count = `All infant` - ) |> - mutate(lad_name = str_replace_all(lad_name, "&", "and")) |> - left_join(ni_lookup) |> - select(lad_code, infant_mortality_count) |> - mutate(year = "2017") +infant_mortality_raw <- read_csv("https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/INFANTMRHSCT/CSV/1.0/") -raw_live_births_2017 <- - read_excel( - list.files( - tempdir(), - pattern = "Births_2017.xls", - full.names = TRUE - ), - sheet = "Table 3.7b", - range = "A4:C52" - ) - -live_births_2017 <- - raw_live_births_2017 |> - slice(-c(1:5)) |> - drop_na() |> - select( - lad_name = Area, - live_birth_count = `All births` +infant_mortality_hb <- infant_mortality_raw |> + filter( + `Grouped Year` == "2018-22", + `Health and Social Care Trust` != "NI" ) |> - mutate(lad_name = str_replace_all(lad_name, "&", "and")) |> - left_join(ni_lookup) |> - select(lad_code, live_birth_count) |> - mutate(year = "2017") - -GET( - "https://www.nisra.gov.uk/sites/nisra.gov.uk/files/publications/RG_2018.zip", - write_disk(tf <- tempfile(fileext = ".zip")) -) - -unzip(tf, exdir = tempdir()) - -raw_infant_deaths_2018 <- - read_excel( - list.files( - tempdir(), - pattern = "Stillbirths_Infant_Deaths_Tables_2018.xlsx", - full.names = TRUE - ), - sheet = "Table 4.4b", - range = "A4:C53" - ) - -infant_deaths_2018 <- - raw_infant_deaths_2018 |> - slice(-c(1:6)) |> - drop_na() |> select( - lad_name = `...1`, - infant_mortality_count = `All infant` - ) |> - mutate(lad_name = str_replace_all(lad_name, "&", "and")) |> - left_join(ni_lookup) |> - select(lad_code, infant_mortality_count) |> - mutate(year = "2018") - -raw_live_births_2018 <- - read_excel( - list.files( - tempdir(), - pattern = "Births_Tables_2018.xlsx", - full.names = TRUE - ), - sheet = "Table 3.7b", - range = "A3:C51" + trust18_name = `Health and Social Care Trust`, + infant_mortality_per_1k = `VALUE` ) -live_births_2018 <- - raw_live_births_2018 |> - slice(-c(1:5)) |> - drop_na() |> - select( - lad_name = Area, - live_birth_count = `All births` - ) |> - mutate(lad_name = str_replace_all(lad_name, "&", "and")) |> - left_join(ni_lookup) |> - select(lad_code, live_birth_count) |> - mutate(year = "2018") -GET( - "https://www.nisra.gov.uk/sites/nisra.gov.uk/files/publications/Stillbirths_InfantDeaths_Tables_2019.xls", - write_disk(tf <- tempfile(fileext = ".xls")) -) +# Join datasets +# Infant mortality data + Trust name and code -raw_infant_deaths_2019 <- - read_excel( - tf, - sheet = "Table 4.4b", - range = "A4:C53" - ) +infant_mortality_hb <- infant_mortality_hb |> + left_join(hb_lookup) |> + select(-trust18_name) |> + relocate(trust18_code) -infant_deaths_2019 <- - raw_infant_deaths_2019 |> - slice(-c(1:6)) |> - drop_na() |> - select( - lad_name = `2019`, - infant_mortality_count = `All infant` - ) |> - mutate(lad_name = str_replace_all(lad_name, "&", "and")) |> - left_join(ni_lookup) |> - select(lad_code, infant_mortality_count) |> - mutate(year = "2019") -GET( - "https://www.nisra.gov.uk/sites/nisra.gov.uk/files/publications/Births_Tables_2019.xlsx", - write_disk(tf <- tempfile(fileext = ".xlsx")) -) +# Infant mortality data + LA code -raw_live_births_2019 <- - read_excel( - tf, - sheet = "Table 3.7b", - range = "A3:C51" - ) - -live_births_2019 <- - raw_live_births_2019 |> - slice(-c(1:5)) |> - drop_na() |> +lives_infant_mortality <- infant_mortality_hb |> + left_join(hb_ltla_lookup) |> + mutate(year = "2018-22") |> select( - lad_name = Area, - live_birth_count = `All births` + ltla24_code = ltla21_code, + infant_mortality_per_1k, + year ) |> - mutate(lad_name = str_replace_all(lad_name, "&", "and")) |> - left_join(ni_lookup) |> - select(lad_code, live_birth_count) |> - mutate(year = "2019") + arrange(ltla24_code) -# ---- Join and calculate mean rate ---- -all_births <- - bind_rows( - live_births_2017, - live_births_2018, - live_births_2019 - ) - -all_deaths <- - bind_rows( - infant_deaths_2017, - infant_deaths_2018, - infant_deaths_2019 - ) |> - mutate(infant_mortality_count = as.double(infant_mortality_count)) - -joined <- - all_births |> - left_join( - all_deaths, - by = c("lad_code", "year") - ) - -infant_mortality <- - joined |> - mutate( - infant_mortality_per_1000 = (infant_mortality_count / live_birth_count) * 1000 - ) |> - group_by(lad_code) |> - summarise(infant_mortality_per_1000 = mean(infant_mortality_per_1000)) -# Save -write_rds(infant_mortality, "data/vulnerability/health-inequalities/northern-ireland/healthy-lives/infant-mortality.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(lives_infant_mortality, overwrite = TRUE) diff --git a/data/lives_infant_mortality.rda b/data/lives_infant_mortality.rda new file mode 100644 index 0000000000000000000000000000000000000000..cc55a73b4cc92e8021923d26792eb06f1bf3637a GIT binary patch literal 303 zcmV+~0nq+JT4*^jL0KkKS*RofH~;}8|K$I_O@IIcf8ay`5J0~#-Jn1K05AXs0s*iA z7)UgUp*==JK+qnbGBf~aH1MG2011Eqm;e9(03=dqrqp_68a)s+4GfJmZ8ZU>rlJ8o z6;x4yf>0`jxfyiPG~c$AO2ccvtL{J&vf9iO2jgQp;?UptjkVMymkrZIUrKNU>OcFOxN{&et z?>HbsAeIzMZ>J$AGbQ96169@1r{g`dSPJ0I8w3~L_d)(n5*?ntK!5)}l1X8_4H BdH( Date: Wed, 8 Jan 2025 15:02:20 +0000 Subject: [PATCH 51/78] First draft completed - child-vaccine-coverage First draft completed - child-vaccine-coverage, styled and rendered. Converted from HB to LA. --- R/data.R | 19 ++++++ data-raw/healthy-lives/vaccination-coverage.R | 55 ++++++++++++++++++ data/lives_child_vaccine_coverage.rda | Bin 0 -> 353 bytes man/lives_child_vaccine_coverage.Rd | 29 +++++++++ metadata.md | 2 +- 5 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 data-raw/healthy-lives/vaccination-coverage.R create mode 100644 data/lives_child_vaccine_coverage.rda create mode 100644 man/lives_child_vaccine_coverage.Rd diff --git a/R/data.R b/R/data.R index 327711a..dfff721 100644 --- a/R/data.R +++ b/R/data.R @@ -104,6 +104,25 @@ #' "lives_teenage_pregnancy" +#' Percentage of Childhood Vaccine Coverage (2022-2023) +#' +#' A dataset containing statistics on childhood vaccine coverage (aged 6 and +#' under) in each Northern Irish Council, 2022/23. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{child_vaccine_coverage_percentage}{Percentage of vaccine coverage. Includes +#' childhood immunisation statistics (DtaP/IPV/Hib(HepB), MenB, Rotavirus, PCV, +#' Hib/MenC, MMR1 (by age 2), MMR1 (by age 5), MMR2 (by age 5). Pre-School Booster)} +#' \item{year}{School Year} +#' +#' ... +#' } +#' @source \url{https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022} +#' +"lives_child_vaccine_coverage" + #' Percentage of Young People in Education, Employment, and Training (2022/23) #' #' A dataset containing statistics on the percentage of young people (aged 16-18) diff --git a/data-raw/healthy-lives/vaccination-coverage.R b/data-raw/healthy-lives/vaccination-coverage.R new file mode 100644 index 0000000..48f56d0 --- /dev/null +++ b/data-raw/healthy-lives/vaccination-coverage.R @@ -0,0 +1,55 @@ +# ---- Load packages ---- +library(tidyverse) +library(httr) +library(readxl) +library(geographr) + +# ---- Get and clean data ---- +# Geographical Code Data: Health Board and Local Authority + +hb_ltla_lookup <- lookup_ltla21_hsct18 |> + distinct(ltla21_code, trust18_code) + +hb_lookup <- boundaries_trusts_ni18 |> + sf::st_drop_geometry() + +# Child vaccination coverage data +# Source: https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022 + +GET( + "https://www.publichealth.hscni.net/sites/default/files/2024-04/Core%20Tables%202022%20-%20Excel%20tables_1.xlsx", + write_disk(tf <- tempfile(fileext = ".xlsx")) +) + +vaccine_raw <- read_excel(tf, sheet = 31, skip = 4) + +vaccine_coverage_hb <- vaccine_raw |> + slice(1:9) |> + mutate(Belfast = as.numeric(Belfast)) |> + pivot_longer(cols = `Belfast`:`Northern Ireland`, names_to = "trust18_name", values_to = "vaccine_coverage_percentage") |> + group_by(trust18_name) |> + summarise(av_vaccine_coverage_percentage = mean(vaccine_coverage_percentage, na.rm = TRUE)) |> + filter(trust18_name != "Northern Ireland") + +# Join datasets +# Child vaccine coverage data + Trust name and code + +vaccine_coverage_hb <- vaccine_coverage_hb |> + left_join(hb_lookup) |> + select(-trust18_name) |> + relocate(trust18_code) + +# Child vaccine data + LA code + +lives_child_vaccine_coverage <- vaccine_coverage_hb |> + left_join(hb_ltla_lookup) |> + mutate(year = "2022-23") |> + select( + ltla24_code = ltla21_code, + child_vaccine_coverage_percentage = av_vaccine_coverage_percentage, + year + ) |> + arrange(ltla24_code) + +# ---- Save output to data/ folder ---- +usethis::use_data(lives_child_vaccine_coverage, overwrite = TRUE) diff --git a/data/lives_child_vaccine_coverage.rda b/data/lives_child_vaccine_coverage.rda new file mode 100644 index 0000000000000000000000000000000000000000..fc8eecd38262f5181f4f58251714892ed4d2465a GIT binary patch literal 353 zcmV-n0iOOsT4*^jL0KkKS#Q+rqyPaX|L_01NCYqg|KODcSWy4x-KanTKmY)M09ZgM z5-tJ(umKoa!&6kmWEu?yfHVex13=S2Xc{!o2B|itY5>q^27nBj8UO}{hK&zIXbB>M zYBnkA13<{oXaHyfL(~8RPbhH2vpnRoFeK#fg3}%m!e6h(bVR`mS8|vDOP(x}#9}jV zX}uR>)YaD4y)Fr!dIH-dt^f>yP;R!jTuVs}&Llg<0^TLU>H7-6{M(Od#Q1MMZ&pm6XY{Fpua48~k0#6yZWazf-c1Z#|3_ literal 0 HcmV?d00001 diff --git a/man/lives_child_vaccine_coverage.Rd b/man/lives_child_vaccine_coverage.Rd new file mode 100644 index 0000000..62ea5c6 --- /dev/null +++ b/man/lives_child_vaccine_coverage.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{lives_child_vaccine_coverage} +\alias{lives_child_vaccine_coverage} +\title{Percentage of Childhood Vaccine Coverage (2022-2023)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{child_vaccine_coverage_percentage}{Percentage of vaccine coverage. Includes +childhood immunisation statistics (DtaP/IPV/Hib(HepB), MenB, Rotavirus, PCV, +Hib/MenC, MMR1 (by age 2), MMR1 (by age 5), MMR2 (by age 5). Pre-School Booster)} +\item{year}{School Year} + +... +} +} +\source{ +\url{https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022} +} +\usage{ +lives_child_vaccine_coverage +} +\description{ +A dataset containing statistics on childhood vaccine coverage (aged 6 and +under) in each Northern Irish Council, 2022/23. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 63f9025..fbb4b27 100644 --- a/metadata.md +++ b/metadata.md @@ -18,7 +18,7 @@ | Healthy Lives | Overweight and Obesity in Adults | :x: | :x: | :x: | :x: - Data unavailable. | :x: | | Healthy Lives | Cancer Screening | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | :x:| ❗: - The data (breast, bowel, and cervical cancers) is at the Health and Social Care Trusts level | :x: | | Healthy Lives | Sexual Health | :x: | :x: | :x: | :x: - Data unavailable. | :x: | -| Healthy Lives | Vaccination Coverage | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | :x: | ❗: - The data is at the Health and Social Care Trusts level | :x: | +| Healthy Lives | Vaccination Coverage | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage of vaccine coverage in children 6 and under | :heavy_check_mark: | | Healthy Lives | Children in State Care | :x: | :x: | :x: | ❗: - Indicator not overtly present in England's HI. To review at the end (and likely remove) | :x: | | Healthy Lives | Infant Mortality | 2018-2022 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only present at HSC level| :x: | | Healthy Lives | Low Birth Weight | 2022-23 | [Public Health Agency](https://www.publichealth.hscni.net/publications/statistical-profile-childrens-health-northern-ireland-202223) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage of infants born with low birth weight (<2,500g) | :heavy_check_mark: | From 9692bfb21cee15a7f1bca5e0dec25ba8d5664739 Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 8 Jan 2025 16:29:43 +0000 Subject: [PATCH 52/78] First draft completed - cancer-screening First draft completed - cancer-screening, styled and rendered. Converted from HB to LA. --- R/data.R | 19 +++++ data-raw/healthy-lives/cancer-screening.R | 89 ++++++++++++++++++++++ data/lives_cancer_screening.rda | Bin 0 -> 343 bytes man/lives_cancer_screening.Rd | 28 +++++++ metadata.md | 2 +- 5 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 data-raw/healthy-lives/cancer-screening.R create mode 100644 data/lives_cancer_screening.rda create mode 100644 man/lives_cancer_screening.Rd diff --git a/R/data.R b/R/data.R index 327711a..6f6df60 100644 --- a/R/data.R +++ b/R/data.R @@ -1,3 +1,22 @@ +#' Percentage of Cancer Screening Uptake (2022-2023) +#' +#' A dataset containing statistics on the percentage of cancer screening uptake +#' in each Northern Irish Council, 2022-2023. +#' +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{cancer_screening_uptake}{Percentage of cancer screening uptake; breast, +#' bowel, and cervical cancer.} +#' \item{year}{Time period} +#' +#' ... +#' } +#' @source \url{https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022} +#' +"lives_cancer_screening" + #' Percentage of Absolute Child Poverty (2017) #' #' A dataset containing statistics on the percentage of children (aged 15 and diff --git a/data-raw/healthy-lives/cancer-screening.R b/data-raw/healthy-lives/cancer-screening.R new file mode 100644 index 0000000..67b43c7 --- /dev/null +++ b/data-raw/healthy-lives/cancer-screening.R @@ -0,0 +1,89 @@ +# ---- Load packages ---- +library(tidyverse) +library(httr) +library(readxl) +library(geographr) + +# ---- Get and clean data ---- +# Geographical Code Data: Health Board and Local Authority + +hb_ltla_lookup <- lookup_ltla21_hsct18 |> + distinct(ltla21_code, trust18_code) + +hb_lookup <- boundaries_trusts_ni18 |> + sf::st_drop_geometry() + +# Cancer Screening data +# Source: https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022 + +GET( + "https://www.publichealth.hscni.net/sites/default/files/2024-04/Core%20Tables%202022%20-%20Excel%20tables_1.xlsx", + write_disk(tf <- tempfile(fileext = ".xlsx")) +) + + +# Cervical Cancer +cervical_raw <- read_excel(tf, sheet = 34, skip = 3) + +cervical_hb <- cervical_raw |> + slice(1:5) |> + select( + trust18_name = HSCT, + cervical_screening_percentage = `% Coverage` + ) + + +# Breast Cancer +breast_raw <- read_excel(tf, sheet = 35, skip = 3) + +breast_hb <- breast_raw |> + slice(1:5) |> + select( + trust18_name = `HSC Trust of residence`, + breast_screening_percentage = `%` + ) + + +# Bowel Cancer +bowel_raw <- read_excel(tf, sheet = 37, skip = 3) + +bowel_hb <- bowel_raw |> + slice(1:5) |> + select( + trust18_name = `HSCT`, + bowel_screening_percentage = `Uptake for bowel cancer screening \r\n(%)` + ) + +# Join datasets +# Cancer Screening Percentages + +cancer_screening_hb <- cervical_hb |> + left_join(breast_hb) |> + left_join(bowel_hb) |> + rowwise() |> + mutate( + total_cancer_screening_percentage = mean(c_across(c(cervical_screening_percentage, breast_screening_percentage, bowel_screening_percentage)), na.rm = TRUE) + ) |> + ungroup() + +# Cancer screening data + Trust name and code +cancer_screening_hb <- cancer_screening_hb |> + left_join(hb_lookup) |> + select( + -trust18_name, -cervical_screening_percentage, -breast_screening_percentage, -bowel_screening_percentage + ) |> + relocate(trust18_code) + +# Cancer screening data + LA code +lives_cancer_screening <- cancer_screening_hb |> + left_join(hb_ltla_lookup) |> + mutate(year = "2022-23") |> + select( + ltla24_code = ltla21_code, + cancer_screening_uptake = total_cancer_screening_percentage, + year + ) |> + arrange(ltla24_code) + +# ---- Save output to data/ folder ---- +usethis::use_data(lives_cancer_screening, overwrite = TRUE) diff --git a/data/lives_cancer_screening.rda b/data/lives_cancer_screening.rda new file mode 100644 index 0000000000000000000000000000000000000000..6fac82e3c82f20c9be56eb889be4d830daca4fd5 GIT binary patch literal 343 zcmV-d0jT~$T4*^jL0KkKStPg_!TI|5E1>ay7CndLF=f+b+(Xx;0O1h3f0CzwWU z?KfN0mseX~V)YebIu?UPl2wUIu}jh`A{BY&K>%kY zVI*@TKOTXhDn{x==@g_{dPKuA9+1|tj~XkXe2K7xuxuwB7YeWzVUYH9Z)6#qMD%+O zV-YrxWoYA}lLYF<6tcb?2o45>O|n2I-zcLco3Wutr4V`q1rQT5L>eJu;C)2#JU<>6 pa$!0XQJtm^ycz>gASVo`%F-eq(+oHGyOJrwgn=c%&JclihV%dc literal 0 HcmV?d00001 diff --git a/man/lives_cancer_screening.Rd b/man/lives_cancer_screening.Rd new file mode 100644 index 0000000..192fab1 --- /dev/null +++ b/man/lives_cancer_screening.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{lives_cancer_screening} +\alias{lives_cancer_screening} +\title{Percentage of Cancer Screening Uptake (2022-2023)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{cancer_screening_uptake}{Percentage of cancer screening uptake; breast, +bowel, and cervical cancer.} +\item{year}{Time period} + +... +} +} +\source{ +\url{https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022} +} +\usage{ +lives_cancer_screening +} +\description{ +A dataset containing statistics on the percentage of cancer screening uptake +in each Northern Irish Council, 2022-2023. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 63f9025..c5ec8f3 100644 --- a/metadata.md +++ b/metadata.md @@ -16,7 +16,7 @@ | Healthy Lives |Cardiovascular Conditions | 2023/24 | [NISRA](https://data.nisra.gov.uk/k) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data only available as separate conditions (CHD, COPD, Heart Failure 1 & 3, Stroke and TIA) as a rate per 1,000. To be comparable to England's Index must be shown as a %. To review at the end. | :x: | | Healthy Lives | High Blood Pressure | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. | :x: | | Healthy Lives | Overweight and Obesity in Adults | :x: | :x: | :x: | :x: - Data unavailable. | :x: | -| Healthy Lives | Cancer Screening | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | :x:| ❗: - The data (breast, bowel, and cervical cancers) is at the Health and Social Care Trusts level | :x: | +| Healthy Lives | Cancer Screening | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx)| heavy_check_mark: Indicator: Percentage of bowel, breast, and cervical cancer screening uptake. | :heavy_check_mark: | | Healthy Lives | Sexual Health | :x: | :x: | :x: | :x: - Data unavailable. | :x: | | Healthy Lives | Vaccination Coverage | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | :x: | ❗: - The data is at the Health and Social Care Trusts level | :x: | | Healthy Lives | Children in State Care | :x: | :x: | :x: | ❗: - Indicator not overtly present in England's HI. To review at the end (and likely remove) | :x: | From fa5a4e4e42dd9b34e519e08f9cdd2230e6fccc22 Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 8 Jan 2025 16:40:37 +0000 Subject: [PATCH 53/78] Updated metadata - drug-misuse Updated metadata - drug-misuse, data unavailable --- metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.md b/metadata.md index 63f9025..2390678 100644 --- a/metadata.md +++ b/metadata.md @@ -3,7 +3,7 @@ | Domain | Indicator | Year | Source | License | Indicator Code Added to `R/` | Data Added to `data/` | | --- | --- | --- | --- | --- | --- | --- | | Healthy Lives | Alcohol Misuse | 2019 | [Census of drug and alcohol treatment services in Northern Ireland](https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level and is an absolute number. Will need to calculate compared to whoe population for a per 100k number. | :x: | -| Healthy Lives | Drug Misuse | 2019 | [Census of drug and alcohol treatment services in Northern Ireland](https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level and is an absolute number. Will need to calculate compared to whoe population for a per 100k number. | :x: | +| Healthy Lives | Drug Misuse | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Lives | Healthy Eating | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | | Healthy Lives | Physical Activity | :x: | :x: | :x:| :x: Data not collected. | :x: | | Healthy Lives | Sedentary Behaviour | :x: | :x: | :x:| :x: - Data unavailable | :x: | From 9823438916862c4f4c0367a5ef441f1af4323f58 Mon Sep 17 00:00:00 2001 From: CatReid Date: Thu, 9 Jan 2025 10:19:03 +0000 Subject: [PATCH 54/78] First draft completed - alcohol-misuse First draft completed - alcohol-misuse, styled and rendered. Calculated per 100k admissions, then from HB to LA. --- R/data.R | 22 +++++++ data-raw/healthy-lives/alcohol-misuse.R | 76 ++++++++++++++++++++++++ data/lives_alcohol_misuse.rda | Bin 0 -> 353 bytes man/lives_alcohol_misuse.Rd | 32 ++++++++++ metadata.md | 2 +- 5 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 data-raw/healthy-lives/alcohol-misuse.R create mode 100644 data/lives_alcohol_misuse.rda create mode 100644 man/lives_alcohol_misuse.Rd diff --git a/R/data.R b/R/data.R index 327711a..e8adadd 100644 --- a/R/data.R +++ b/R/data.R @@ -1,3 +1,25 @@ +#' Rate of Patient Admissions for Alcohol Related Conditions (2019) +#' +#' A dataset containing statistics on the rate of patient admissions for +#' all alcohol-related admissions in each Northern Irish Council, 2019. +#' +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{alcohol_admissions_rate_per_100k}{Rate of patient admissions per 100k +#' population, based on population numbers per HSCT, converted to Local +#' Authority level. Patients are counted only once in the year in which they +#' have an alcohol-related stay.} +#' \item{year}{Time period} +#' +#' ... +#' } +#' @source \url{https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019} +#' @source \url{https://data.nisra.gov.uk/} +#' +"lives_alcohol_misuse" + #' Percentage of Absolute Child Poverty (2017) #' #' A dataset containing statistics on the percentage of children (aged 15 and diff --git a/data-raw/healthy-lives/alcohol-misuse.R b/data-raw/healthy-lives/alcohol-misuse.R new file mode 100644 index 0000000..8614373 --- /dev/null +++ b/data-raw/healthy-lives/alcohol-misuse.R @@ -0,0 +1,76 @@ +# ---- Load packages ---- +library(tidyverse) +library(httr) +library(readxl) +library(geographr) + +# ---- Get and clean data ---- +# Geographical Code Data: Health Board and Local Authority + +hb_ltla_lookup <- lookup_ltla21_hsct18 |> + distinct(ltla21_code, trust18_code) + +hb_lookup <- boundaries_trusts_ni18 |> + sf::st_drop_geometry() + +# Alcohol Misuse Data: +# Source: https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019 + +GET( + "https://www.health-ni.gov.uk/sites/default/files/publications/health/data-census-drug-alcohol-treatment-services-2019.xlsx", + write_disk(tf <- tempfile(fileext = ".xlsx")) +) + +alcohol_misuse_raw <- read_excel(tf, sheet = 5, skip = 3) + +alcohol_misuse_hb <- alcohol_misuse_raw |> + slice(2:6) |> + mutate(across(2:5, as.numeric)) |> + select( + trust18_name = `...1`, + alcohol_admissions_numbers = `Alcohol Only` + ) + +# Population data - HSCT Level +# Source: https://data.nisra.gov.uk/ + +population_raw <- read_csv("https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/C21001HSCT/CSV/1.0/") + +population_hb <- population_raw |> + select( + trust18_name = `Health and Social Care Trust`, + population_total = `VALUE` + ) + +# Join datasets +# Population + Alcohol Misuse + +alcohol_misuse_rate_hb <- alcohol_misuse_hb |> + left_join(population_hb) |> + mutate(alcohol_admissions_rate_per_100k = (alcohol_admissions_numbers / population_total) * 100000) |> + select( + trust18_name, + alcohol_admissions_rate_per_100k + ) + +# Alcohol misuse data + Trust name and code + +alcohol_misuse_rate_hb <- alcohol_misuse_rate_hb |> + left_join(hb_lookup) |> + select(-trust18_name) |> + relocate(trust18_code) + +# Alcohol misuse data + LA code +lives_alcohol_misuse <- alcohol_misuse_rate_hb |> + left_join(hb_ltla_lookup) |> + mutate(year = "2019") |> + select( + ltla24_code = ltla21_code, + alcohol_admissions_rate_per_100k, + year + ) |> + arrange(ltla24_code) + +# ---- Save output to data/ folder ---- +usethis::use_data(lives_alcohol_misuse, overwrite = TRUE) + diff --git a/data/lives_alcohol_misuse.rda b/data/lives_alcohol_misuse.rda new file mode 100644 index 0000000000000000000000000000000000000000..288b5ccd73cb1dc4664efbab6dd0039e55730b8a GIT binary patch literal 353 zcmV-n0iOOsT4*^jL0KkKSrGB*pa208|Ns9#Yyv<5f8ay~Qc%DD-=IJM1P}lL06-8J z0)UV}4$H6s7+MKb(^UOa^-UNP6B7UcA%QbUzye}pCWBPeGGxq<28@6J0i!?w9-*KB zB#9(>Pg7z+pfu3UKmY^O0002>4iU>d#Idj>yZ(pZN4y!MVXfv55bO2-ufs$kn4xrA!fo;y{s2HSRtd;8 Date: Thu, 9 Jan 2025 12:18:19 +0000 Subject: [PATCH 55/78] First draft completed - suicides First draft completed - suicides, styled and rendered. Converted from HB to LA. --- R/data.R | 17 ++++++++ data-raw/healthy-people/suicides.R | 68 ++++++++++++++++++++++------- data/people_suicide.rda | Bin 0 -> 307 bytes man/people_suicide.Rd | 28 ++++++++++++ metadata.md | 2 +- 5 files changed, 98 insertions(+), 17 deletions(-) create mode 100644 data/people_suicide.rda create mode 100644 man/people_suicide.Rd diff --git a/R/data.R b/R/data.R index 327711a..e1f5e03 100644 --- a/R/data.R +++ b/R/data.R @@ -307,3 +307,20 @@ #' @source \url{https://data.nisra.gov.uk/} #' "people_self_harm" + +#' Deaths from Suicide (2019-2021) +#' +#' A dataset containing statistics from deaths by suicide, by Northern Irish +#' Council. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{suicide_rate_per_100k}{Deaths from suicide (16+). +#' Age standardised rate per 100,000.} +#' \item{year}{Time period - 3 year aggregate} +#' +#' ... +#' } +#' @source \url{https://www.nisra.gov.uk/publications/suicide-statistics-2022} +"people_suicide" diff --git a/data-raw/healthy-people/suicides.R b/data-raw/healthy-people/suicides.R index 1d194f9..658442b 100644 --- a/data-raw/healthy-people/suicides.R +++ b/data-raw/healthy-people/suicides.R @@ -1,25 +1,61 @@ +# ---- Load packages ---- library(tidyverse) library(httr) -library(readODS) +library(readxl) +library(geographr) + +# ---- Get and clean data ---- + +# Geographical Code Data: Health Board and Local Authority + +hb_ltla_lookup <- lookup_ltla21_hsct18 |> + distinct(ltla21_code, trust18_code) + +hb_lookup <- boundaries_trusts_ni18 |> + sf::st_drop_geometry() + +# Suicide Data +# Source: https://www.nisra.gov.uk/publications/suicide-statistics-2022 GET( - "https://www.ninis2.nisra.gov.uk/Download/Population/Deaths%20by%20Cause%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) + "https://www.nisra.gov.uk/system/files/statistics/Suicide%20Statistics%202022%20Tables.xlsx", + write_disk(tf <- tempfile(fileext = ".xlsx")) ) -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "B4:M15" - ) +suicides_raw <- read_excel(tf, sheet = 16, skip = 5) + +suicides_hb <- suicides_raw |> + filter(`Number and Rate` == "Age-Standardised rate") |> + slice(7:9) |> + pivot_longer(cols = `Belfast`:`Western`, names_to = "trust18_name", values_to = "suicide_rate_per_100k") |> + mutate(suicide_rate_per_100k = as.numeric(suicide_rate_per_100k)) |> + group_by(trust18_name) |> + mutate(aggregate_suicide_rate_per_100k = sum(suicide_rate_per_100k, na.rm = TRUE)) |> + ungroup() |> + select( + trust18_name, + aggregate_suicide_rate_per_100k + ) |> + distinct(aggregate_suicide_rate_per_100k, .keep_all = TRUE) + +# Join datasets +# Suicide data + Trust name and code + +suicides_hb <- suicides_hb |> + left_join(hb_lookup) |> + select(-trust18_name) |> + relocate(trust18_code) -suicide <- - raw |> - as_tibble() |> +# Suicide data + LA code +people_suicide <- suicides_hb |> + left_join(hb_ltla_lookup) |> + mutate(year = "2019-2021") |> select( - lad_code = `LGD2014 Code`, - suicide_percentage_of_all_deaths = `Deaths from suicide and undetermined intent (%)` - ) + ltla24_code = ltla21_code, + suicide_rate_per_100k = aggregate_suicide_rate_per_100k, + year + ) |> + arrange(ltla24_code) -write_rds(suicide, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/suicide.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(people_suicide, overwrite = TRUE) diff --git a/data/people_suicide.rda b/data/people_suicide.rda new file mode 100644 index 0000000000000000000000000000000000000000..dcb5de270428d45e270c0f4bb6483bf86b9c3b28 GIT binary patch literal 307 zcmV-30nGkFT4*^jL0KkKSqQtK=l}sT|MLGkN+19Of8k6C5MaMA-k?AL05Aan03ZSZ zumJWLG*cAXnrIC@Kr{dV(?HRusp$hrsSJ$K4K!j60Lai}G7nJo0xAhcYHdT*(9j-8 z@`0hF)BpfrHE}5ow15bVB>P}93be-ssnQlu1%xi&h5!Uq^~z$@6E*yCm6qq^<+}Wy zRYxshWCG9v0EWr-gjOhRlL<6JFa#Yn#2R7J=!7>^!|OFj1k{c(PUR;lDP2Agp-EMp zPQ@msN(@j;YE4ZcabyC51cL}PseX?9Ij*+X<}>#vFImug32;J*%@eFXbpEs`CtxQD z+#Dltg%D%RONmTm(J^YUoJg3|mc7ZZUwlC)Nl1ZE9YK(gfYv(?$OaGiyOJrwgn&ie F4?u(|d~N^$ literal 0 HcmV?d00001 diff --git a/man/people_suicide.Rd b/man/people_suicide.Rd new file mode 100644 index 0000000..2059bb5 --- /dev/null +++ b/man/people_suicide.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{people_suicide} +\alias{people_suicide} +\title{Deaths from Suicide (2019-2021)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{suicide_rate_per_100k}{Deaths from suicide (16+). +Age standardised rate per 100,000.} +\item{year}{Time period - 3 year aggregate} + +... +} +} +\source{ +\url{https://www.nisra.gov.uk/publications/suicide-statistics-2022} +} +\usage{ +people_suicide +} +\description{ +A dataset containing statistics from deaths by suicide, by Northern Irish +Council. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 2390678..64ee458 100644 --- a/metadata.md +++ b/metadata.md @@ -33,7 +33,7 @@ | Healthy People | Children’s Social, Emotional and Mental Health | 2020 | [Youth Wellbeing Prevalence Survey](https://online.hscni.net/our-work/social-care-and-children/children-and-young-people/youth-wellbeing-prevalence-survey-2020/) | :x: | :x: (Raw) data unavailable and only at HSC level | :x: | | Healthy People | Mental Health Condition | 2021 | [Census](https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage of adult population (aged 15+) with an emotional, psychological, or mental health condition | :heavy_check_mark: | | Healthy People | Self-harm | 2018/19-2022/23 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Rate of self-harm related admissions per 100,000, standardised by age and sex. | :heavy_check_mark: | -| Healthy People | Suicides | 2019 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data unavailable - contact info@nisra.gov.uk and ask for Deaths by Cause (administrative geographies) | :x: | +| Healthy People | Suicides | 2019-2021 | [NISRA](https://www.nisra.gov.uk/publications/suicide-statistics-2022) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Deaths by suicide, 16+, per 100,000 | :heavy_check_mark: | | Healthy People | Avoidable Deaths | 2015-19 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data unavailable - contact healthinequalities@health-ni.gov.uk and ask for Standardised Death Rate - Avoidable (administrative geographies) | :x: | | Healthy People | Mortality from All Causes | 2020-22 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Age/sex-standardised all mortality rates per 100k | :heavy_check_mark: | | Healthy People | Healthy Life Expectancy | 2016-2018 | [ONS](https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/healthandlifeexpectancies/datasets/healthstatelifeexpectancyatbirthandatage65bylocalareasuk) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | From a75dffa0bfe6b24f1e894a9fb190b1273774e1be Mon Sep 17 00:00:00 2001 From: CatReid Date: Thu, 9 Jan 2025 13:52:14 +0000 Subject: [PATCH 56/78] First-draft completed - avoidable deaths First-draft completed - avoidable deaths, styled and rendered --- R/data.R | 17 ++++++++++ data-raw/healthy-people/avoidable-deaths.R | 36 ++++++++++----------- data/people_avoidable_deaths.rda | Bin 0 -> 316 bytes man/people_avoidable_deaths.Rd | 28 ++++++++++++++++ metadata.md | 2 +- 5 files changed, 63 insertions(+), 20 deletions(-) create mode 100644 data/people_avoidable_deaths.rda create mode 100644 man/people_avoidable_deaths.Rd diff --git a/R/data.R b/R/data.R index 327711a..92e7c43 100644 --- a/R/data.R +++ b/R/data.R @@ -179,6 +179,23 @@ #' @source \url{https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4} "people_anxiety" +#' Rate of Avoidable Deaths per 100k (2018-2022) +#' +#' A dataset containing statistics on age-standardised death rates per 100k, by +#' Northern Irish Council (2018-2022). +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{avoidable_deaths_per_100k}{Age-standardised avoidable mortality rates per +#' 100k} +#' \item{year}{5-year aggregate period} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +"people_avoidable_deaths" + #' Percentage of People Aged 15-64 with Long-Term Health Problem/Disability #' that Limits Daily Activities #' diff --git a/data-raw/healthy-people/avoidable-deaths.R b/data-raw/healthy-people/avoidable-deaths.R index 3fe785d..9d6813a 100644 --- a/data-raw/healthy-people/avoidable-deaths.R +++ b/data-raw/healthy-people/avoidable-deaths.R @@ -1,25 +1,23 @@ +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readODS) -GET( - "https://www.ninis2.nisra.gov.uk/Download/Health%20and%20Social%20Care/Standardised%20Death%20Rate%20-%20Avoidable%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) +# ---- Get and clean data ---- +# Avoidable Deaths Data +# Source: https://data.nisra.gov.uk/ +avoidable_deaths_raw <- read_csv("https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/SDROECDLGD/CSV/1.0/") -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "B4:E15" - ) - -avoidable_deaths <- - raw |> - as_tibble() |> +people_avoidable_deaths <- avoidable_deaths_raw |> + filter( + `Grouped Year` == "2018-22", + `Sex Label` == "All Persons", + `Statistic Label` == "Avoidable deaths per 100,000 population", + LGD2014 != "N92000002" + ) |> select( - lad_code = `LGD2014 Code`, - avoidable_death_rate_per_100000 = `Standardised Death Rate - Avoidable (per 100,000): All` + ltla24_code = LGD2014, + avoidable_deaths_per_100k = VALUE, + year = `Grouped Year` ) -write_rds(avoidable_deaths, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/avoidable-deaths.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(people_avoidable_deaths, overwrite = TRUE) diff --git a/data/people_avoidable_deaths.rda b/data/people_avoidable_deaths.rda new file mode 100644 index 0000000000000000000000000000000000000000..ef1a782f222015e1c8f5b87c38bcff8a2813beec GIT binary patch literal 316 zcmV-C0mJ@6T4*^jL0KkKSIS7fJxP;KNYS7)$)iD`h|?i}m=Q@e6J(k) zGzNi?7?>s?4^XoMxv=)T+;l+*lBjdhK|GJJB0Nyn^r+{Jxc;+ z(Y;Q%nwC_Z&owkDyE4QDDn{a$WHHMIyee0V$7UXGs4#Zq`mTQkq{4(p4Si5+5|u+L z5;wK6n$wTqf#^U~QX8lhc#;lbCPhf5Vhtv0edaG@ch+F;ChT!|h4 literal 0 HcmV?d00001 diff --git a/man/people_avoidable_deaths.Rd b/man/people_avoidable_deaths.Rd new file mode 100644 index 0000000..c9dfe72 --- /dev/null +++ b/man/people_avoidable_deaths.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{people_avoidable_deaths} +\alias{people_avoidable_deaths} +\title{Rate of Avoidable Deaths per 100k (2018-2022)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{avoidable_deaths_per_100k}{Age-standardised avoidable mortality rates per +100k} +\item{year}{5-year aggregate period} + +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +people_avoidable_deaths +} +\description{ +A dataset containing statistics on age-standardised death rates per 100k, by +Northern Irish Council (2018-2022). +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 2390678..332565f 100644 --- a/metadata.md +++ b/metadata.md @@ -34,7 +34,7 @@ | Healthy People | Mental Health Condition | 2021 | [Census](https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage of adult population (aged 15+) with an emotional, psychological, or mental health condition | :heavy_check_mark: | | Healthy People | Self-harm | 2018/19-2022/23 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Rate of self-harm related admissions per 100,000, standardised by age and sex. | :heavy_check_mark: | | Healthy People | Suicides | 2019 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data unavailable - contact info@nisra.gov.uk and ask for Deaths by Cause (administrative geographies) | :x: | -| Healthy People | Avoidable Deaths | 2015-19 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data unavailable - contact healthinequalities@health-ni.gov.uk and ask for Standardised Death Rate - Avoidable (administrative geographies) | :x: | +| Healthy People | Avoidable Deaths | 2018-22 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Age-standardised avoidable mortality rates per 100k | :heavy_check_mark: | | Healthy People | Mortality from All Causes | 2020-22 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Age/sex-standardised all mortality rates per 100k | :heavy_check_mark: | | Healthy People | Healthy Life Expectancy | 2016-2018 | [ONS](https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/healthandlifeexpectancies/datasets/healthstatelifeexpectancyatbirthandatage65bylocalareasuk) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | | Healthy People | Happiness | 2022-23 | [ONS](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Average personal ratings on feelings of happiness out of 10.| :heavy_check_mark: | From c0b050d0b54d677dd8e268033f96cbcf135d158c Mon Sep 17 00:00:00 2001 From: CatReid Date: Thu, 9 Jan 2025 14:55:14 +0000 Subject: [PATCH 57/78] First draft completed - diabetes First draft completed - diabetes, styled and rendered. --- R/data.R | 16 +++++++++++++ data-raw/healthy-people/diabetes.R | 36 ++++++++++++++--------------- data/people_diabetes.rda | Bin 0 -> 381 bytes man/people_diabetes.Rd | 27 ++++++++++++++++++++++ metadata.md | 2 +- 5 files changed, 62 insertions(+), 19 deletions(-) create mode 100644 data/people_diabetes.rda create mode 100644 man/people_diabetes.Rd diff --git a/R/data.R b/R/data.R index 327711a..250d920 100644 --- a/R/data.R +++ b/R/data.R @@ -179,6 +179,22 @@ #' @source \url{https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4} "people_anxiety" +#' Percentage prevalence of diabetes (2023-2024) +#' +#' A dataset containing statistics on the percentage prevalence of people with +#' diabetes, by Northern Irish Council (2023-2024). +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{diabetes_percentage}{Percentage prevalence of diabetes (all types)} +#' \item{year}{Time period} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +"people_diabetes" + #' Percentage of People Aged 15-64 with Long-Term Health Problem/Disability #' that Limits Daily Activities #' diff --git a/data-raw/healthy-people/diabetes.R b/data-raw/healthy-people/diabetes.R index f7bd225..9e1b334 100644 --- a/data-raw/healthy-people/diabetes.R +++ b/data-raw/healthy-people/diabetes.R @@ -1,25 +1,25 @@ +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readODS) -GET( - "https://www.ninis2.nisra.gov.uk/Download/Health%20and%20Social%20Care/Disease%20Prevalence%20(Quality%20Outcomes%20Framework)%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) +# ---- Get and clean data ---- +# Diabetes Data +# Source: https://data.nisra.gov.uk/ -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "B4:AL15" - ) +diabetes_raw <- read_csv("https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/DISPREVLGD/CSV/1.0/") -diabetes <- - raw |> - as_tibble() |> +people_diabetes <- diabetes_raw |> + filter( + `Financial Year` == "2023/24", + `Disease` == "Diabetes Mellitus", + `Statistic Label` == "Raw disease prevalence per 1,000 patients", + LGD2014 != "N92000002" + ) |> + mutate(diabetes_percentage = (VALUE / 10)) |> select( - lad_code = `LGD2014 Code`, - diabetes_per_1000_patients = `Diabetes Mellitus Register: Raw Prevalence per 1,000 patients aged 17+ years` + ltla24_code = LGD2014, + diabetes_percentage, + year = `Financial Year` ) -write_rds(diabetes, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/diabetes.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(people_diabetes, overwrite = TRUE) diff --git a/data/people_diabetes.rda b/data/people_diabetes.rda new file mode 100644 index 0000000000000000000000000000000000000000..a5012abbd5c934799949cb950f3ae870894fa346 GIT binary patch literal 381 zcmV-@0fPQQT4*^jL0KkKS^SlXLjVCQ|NsB{$vwr%|LII&kY&HO-JxKPN`Qa_1QifK z01|-!0uitQ7)=dCO)_dR88p#=MrchM0f5jGL4YQh!9nV0s48kbOw`Z-XaE2J0imD( z9-sgK03?z|M0rQ4>SzD}15DHaG5`Po000~nkjEJm<^-HqyMF!7Absk;ywM_S1P%F( z#PA7iPmrAWi&}W@k0T}eIaH~`y%VdW3zkV;01SafGE9O;f#Q=*XP5-Mm=Y>T;Z1B- zM95uNL1!?0uu-;`U$1YY>hU5AL;-w}K_g`%WyH24tffevkwGBw1i=UjQr;*C5QFS& zs-C7f(&=vxU88m}iAHG_*OaE@o#@(PE3%p&)6yZWc@>VGfK+~XH literal 0 HcmV?d00001 diff --git a/man/people_diabetes.Rd b/man/people_diabetes.Rd new file mode 100644 index 0000000..1afb96b --- /dev/null +++ b/man/people_diabetes.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{people_diabetes} +\alias{people_diabetes} +\title{Percentage prevalence of diabetes (2023-2024)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{diabetes_percentage}{Percentage prevalence of diabetes (all types)} +\item{year}{Time period} + +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +people_diabetes +} +\description{ +A dataset containing statistics on the percentage prevalence of people with +diabetes, by Northern Irish Council (2023-2024). +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 2390678..b59d2e1 100644 --- a/metadata.md +++ b/metadata.md @@ -48,7 +48,7 @@ | Healthy People | Cardiovascular Conditions: Peripheral Arterial Disease | :x: | :x: | :x: This indicator not overtly present in or acting as a substitute for a similar indicator in England's Health Index. To check at the end.| :x: - data unavailable | :x: | | Healthy People | Cardiovascular Conditions: Stroke and TIA | 2021 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :x: This indicator not overtly present in or acting as a substitute for a similar indicator in England's Health Index. To check at the end.| :x: | | Healthy People | Dementia | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index.| :x: | -| Healthy People | Diabetes | ? | [NISRA](https://datavis.nisra.gov.uk/dissemination/NINIS-redirect.html) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data currently unavailable. Raw disease prevalence only shows data per 1,000 (England's Health Index uses %). Other alternative could be 'Prescriptions for drugs used to treat Diabetes (administrative geographies) (4), but need to contact info.bso@hscni.net to check. Review at the end. | :x: | +| Healthy People | Diabetes | 2023-24 | [NISRA]https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage prevalence of people diagnosed with diabetes. | :heavy_check_mark: | | Healthy People | Kidney and Liver Disease | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy People | Musculoskeletal Conditions | :x: | :x: | :x: | :x: No data available | :x: | | Healthy People | Respiratory Conditions: Asthma | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. Respiratory Conditions is treated as 1 indicator. | :x: | From dc2883ecfc760fa0fc6d82487c35816ddaef8388 Mon Sep 17 00:00:00 2001 From: CatReid Date: Thu, 9 Jan 2025 15:25:05 +0000 Subject: [PATCH 58/78] Updated metadata - noise-complaints Updated metadata - noise-complaints. Now contacted email address. --- metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.md b/metadata.md index 2390678..775d684 100644 --- a/metadata.md +++ b/metadata.md @@ -65,7 +65,7 @@ | Healthy Places | Personal Crime | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Personal crime per 1,000 people. | :heavy_check_mark: | | Healthy Places | Low-Level Crime | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Places | Air Pollution | 2019 | [DEFRA](https://uk-air.defra.gov.uk/data/pcm-data) | [OGL3](https://www.gov.scot/crown-copyright/) | :heavy_check_mark: | :heavy_check_mark: | -| Healthy Places | Noise Complaints | 2024 | [DAERA](https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Raw data currently unavailable (only in a report). Need to contact aeqteam@daera-ni.gov.uk and ask for raw data in Figure 1 of report | :heavy_exclamation_mark: | +| Healthy Places | Noise Complaints | 2024 | [DAERA](https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Raw data currently unavailable (only in a report). UPDATE: Now contacted aeqteam@daera-ni.gov.uk and asked for raw data in Figure 1 of report | :heavy_exclamation_mark: | | Healthy Places | Road Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Road Traffic Volume | :x: | :x: | :x: | :x: Indicator not overtly present in England's Health Index. To review at the end. | :x: | | Healthy Places | Internet access | :x: | :x: | :x: | :x: TO DO | :x: | From d23d2aa1c3c6d8ceb44fb9de7361a49d1884813b Mon Sep 17 00:00:00 2001 From: CatReid Date: Thu, 9 Jan 2025 16:22:20 +0000 Subject: [PATCH 59/78] Updated metadata - early-years-development Updated metadata - early-years-development. Contacted for data access. --- metadata.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.md b/metadata.md index 775d684..84280ae 100644 --- a/metadata.md +++ b/metadata.md @@ -8,7 +8,7 @@ | Healthy Lives | Physical Activity | :x: | :x: | :x:| :x: Data not collected. | :x: | | Healthy Lives | Sedentary Behaviour | :x: | :x: | :x:| :x: - Data unavailable | :x: | | Healthy Lives | Smoking | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | -| Healthy Lives | Early Years Development | NA | [NISRA](https://datavis.nisra.gov.uk/dissemination/NINIS-redirect.html) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data unavailable - contact statistics@education-ni.gov.uk | :x: | +| Healthy Lives | Early Years Development | NA | [NISRA](https://datavis.nisra.gov.uk/dissemination/NINIS-redirect.html) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data unavailable - UPDATED contacted statistics@education-ni.gov.uk (9.1.25) | :x: | | Healthy Lives | Pupil Absence | 2021/22 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage of unauthorised school absences| :heavy_check_mark: | | Healthy Lives | GCSE Achievement | 2022-23 | [NISRA](https://data.nisra.gov.uk/) | [NISRA](https://data.nisra.gov.uk/) | :heavy_check_mark: Indicator: Percentage of GSCE attainment, including Maths and English (Grades A-C) | :heavy_check_mark: | | Healthy Lives | Young People's Education, Employment and Training | 2018 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | @@ -65,7 +65,7 @@ | Healthy Places | Personal Crime | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Personal crime per 1,000 people. | :heavy_check_mark: | | Healthy Places | Low-Level Crime | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Places | Air Pollution | 2019 | [DEFRA](https://uk-air.defra.gov.uk/data/pcm-data) | [OGL3](https://www.gov.scot/crown-copyright/) | :heavy_check_mark: | :heavy_check_mark: | -| Healthy Places | Noise Complaints | 2024 | [DAERA](https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Raw data currently unavailable (only in a report). UPDATE: Now contacted aeqteam@daera-ni.gov.uk and asked for raw data in Figure 1 of report | :heavy_exclamation_mark: | +| Healthy Places | Noise Complaints | 2024 | [DAERA](https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Raw data currently unavailable (only in a report). UPDATE: Now contacted aeqteam@daera-ni.gov.uk and asked for raw data in Figure 1 of report (9.1.25) | :heavy_exclamation_mark: | | Healthy Places | Road Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Road Traffic Volume | :x: | :x: | :x: | :x: Indicator not overtly present in England's Health Index. To review at the end. | :x: | | Healthy Places | Internet access | :x: | :x: | :x: | :x: TO DO | :x: | From 6c7e65f9fac718eaa2570165c2fd3c083d36e36c Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 13 Jan 2025 08:36:36 +0000 Subject: [PATCH 60/78] Updated metadata - early-years-development Updated metadata - early-years-development. No data available - received response 10.1.25. --- metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.md b/metadata.md index 84280ae..8ff147d 100644 --- a/metadata.md +++ b/metadata.md @@ -8,7 +8,7 @@ | Healthy Lives | Physical Activity | :x: | :x: | :x:| :x: Data not collected. | :x: | | Healthy Lives | Sedentary Behaviour | :x: | :x: | :x:| :x: - Data unavailable | :x: | | Healthy Lives | Smoking | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | -| Healthy Lives | Early Years Development | NA | [NISRA](https://datavis.nisra.gov.uk/dissemination/NINIS-redirect.html) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data unavailable - UPDATED contacted statistics@education-ni.gov.uk (9.1.25) | :x: | +| Healthy Lives | Early Years Development | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Lives | Pupil Absence | 2021/22 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage of unauthorised school absences| :heavy_check_mark: | | Healthy Lives | GCSE Achievement | 2022-23 | [NISRA](https://data.nisra.gov.uk/) | [NISRA](https://data.nisra.gov.uk/) | :heavy_check_mark: Indicator: Percentage of GSCE attainment, including Maths and English (Grades A-C) | :heavy_check_mark: | | Healthy Lives | Young People's Education, Employment and Training | 2018 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | From d62e0002a733183b42eb805cd5ceec1a79ba66ee Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 13 Jan 2025 12:37:23 +0000 Subject: [PATCH 61/78] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7cc8b6a..5d090d6 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ po/*~ # RStudio Connect folder rsconnect/ .Rproj.user +*.xlsx From 4109cdeddbab32e0b475debd8be0bc2f45ea7dba Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 13 Jan 2025 12:46:22 +0000 Subject: [PATCH 62/78] Created noise-complaints data and uploaded raw file Created noise-complaints data and uploaded raw file --- data-raw/healthy-people/noise-complaints.R | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 data-raw/healthy-people/noise-complaints.R diff --git a/data-raw/healthy-people/noise-complaints.R b/data-raw/healthy-people/noise-complaints.R new file mode 100644 index 0000000..a683706 --- /dev/null +++ b/data-raw/healthy-people/noise-complaints.R @@ -0,0 +1,3 @@ +# Raw data files were not available to download from online. +# Noise-complaints data was available from a published reported (sourced below). +# From 3e78eeb272ce58b13adac2886f4ffbf2053cf3ee Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 13 Jan 2025 13:00:21 +0000 Subject: [PATCH 63/78] First draft started - noise-complaints First draft started - noise-complaints --- data-raw/healthy-people/noise-complaints.R | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/data-raw/healthy-people/noise-complaints.R b/data-raw/healthy-people/noise-complaints.R index a683706..c7b4d0f 100644 --- a/data-raw/healthy-people/noise-complaints.R +++ b/data-raw/healthy-people/noise-complaints.R @@ -1,3 +1,15 @@ # Raw data files were not available to download from online. # Noise-complaints data was available from a published reported (sourced below). -# +# Data is available in the following file path: +# healthindexni > data-raw > healthy-people > noise-complaints.xlsx + +# ---- Load packages ---- +library(tidyverse) +library(httr) +library(readxl) +library(geographr) + +# ---- Get and clean data ---- +# Noise Complaints Data +# Source: https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF + From eacb50ae94296fd5662770f4c6fd51a9d19c56f2 Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 13 Jan 2025 13:41:21 +0000 Subject: [PATCH 64/78] Uploaded noise-complaints data Uploaded noise-complaints data. Need to rename LA to successfully join datasets --- data-raw/healthy-people/noise-complaints.R | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/data-raw/healthy-people/noise-complaints.R b/data-raw/healthy-people/noise-complaints.R index c7b4d0f..65ba342 100644 --- a/data-raw/healthy-people/noise-complaints.R +++ b/data-raw/healthy-people/noise-complaints.R @@ -1,7 +1,7 @@ # Raw data files were not available to download from online. # Noise-complaints data was available from a published reported (sourced below). # Data is available in the following file path: -# healthindexni > data-raw > healthy-people > noise-complaints.xlsx +# healthindexni > data-raw > healthy-people > noise_complaints_data.xlsx # ---- Load packages ---- library(tidyverse) @@ -13,3 +13,31 @@ library(geographr) # Noise Complaints Data # Source: https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF +noise_complaints_raw <- read_excel("data-raw/healthy-people/noise_complaints_data.xlsx", skip = 4) + +noise_complaints <- noise_complaints_raw |> + select(ltla24_name = Council, + noise_complaints_per_1k = "Complaints per 1000") + + + +# need to rename: +# Armagh City, Banbridge and Craigavon - Armagh, Banbridge and Craigavon +# Derry City and Strabane - Derry and Strabane +# Ards and North Down - North Down and Ards + +# THEN join datasets + + + +# LA ID +lookup <- lookup_sa11_soa11_lgd18 |> + select(lgd18_name, lgd18_code) |> + distinct(lgd18_name, lgd18_code) |> + select (ltla24_name = lgd18_name, + ltla24_code = lgd18_code) + +# Join datasets +places_noise_complaints <- noise_complaints |> + left_join(lookup) + From 58f6f3f304b42a8dd9fff32c7db58711857b8c51 Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 13 Jan 2025 15:00:42 +0000 Subject: [PATCH 65/78] Joined data sets for noise-complaints indicator Joined data sets for noise-complaints indicator, but NA consistently returning back for one LA - cannot figure out why. --- data-raw/healthy-people/noise-complaints.R | 43 --------------- data-raw/healthy-places/noise-complaints.R | 62 +++++++++++++++------- 2 files changed, 44 insertions(+), 61 deletions(-) delete mode 100644 data-raw/healthy-people/noise-complaints.R diff --git a/data-raw/healthy-people/noise-complaints.R b/data-raw/healthy-people/noise-complaints.R deleted file mode 100644 index 65ba342..0000000 --- a/data-raw/healthy-people/noise-complaints.R +++ /dev/null @@ -1,43 +0,0 @@ -# Raw data files were not available to download from online. -# Noise-complaints data was available from a published reported (sourced below). -# Data is available in the following file path: -# healthindexni > data-raw > healthy-people > noise_complaints_data.xlsx - -# ---- Load packages ---- -library(tidyverse) -library(httr) -library(readxl) -library(geographr) - -# ---- Get and clean data ---- -# Noise Complaints Data -# Source: https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF - -noise_complaints_raw <- read_excel("data-raw/healthy-people/noise_complaints_data.xlsx", skip = 4) - -noise_complaints <- noise_complaints_raw |> - select(ltla24_name = Council, - noise_complaints_per_1k = "Complaints per 1000") - - - -# need to rename: -# Armagh City, Banbridge and Craigavon - Armagh, Banbridge and Craigavon -# Derry City and Strabane - Derry and Strabane -# Ards and North Down - North Down and Ards - -# THEN join datasets - - - -# LA ID -lookup <- lookup_sa11_soa11_lgd18 |> - select(lgd18_name, lgd18_code) |> - distinct(lgd18_name, lgd18_code) |> - select (ltla24_name = lgd18_name, - ltla24_code = lgd18_code) - -# Join datasets -places_noise_complaints <- noise_complaints |> - left_join(lookup) - diff --git a/data-raw/healthy-places/noise-complaints.R b/data-raw/healthy-places/noise-complaints.R index 36f1632..7a1a74c 100644 --- a/data-raw/healthy-places/noise-complaints.R +++ b/data-raw/healthy-places/noise-complaints.R @@ -1,25 +1,51 @@ +# Raw data files were not available to download from online. +# Noise-complaints data was available from a published reported (sourced below). +# Data is available in the following file path: +# healthindexni > data-raw > healthy-places > noise_complaints_data.xlsx + +# ---- Load packages ---- library(tidyverse) -library(readODS) library(httr) +library(readxl) +library(geographr) -GET( - "https://www.ninis2.nisra.gov.uk/Download/Agriculture%20and%20Environment/Noise%20Complaints%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) +# ---- Get and clean data ---- +# Noise Complaints Data +# Source: https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "A4:E15" - ) +noise_complaints_raw <- read_excel("data-raw/healthy-places/noise_complaints_data.xlsx", skip = 4) -noise <- - raw |> - as_tibble() |> - select( - lad_code = `LGD2014 Code`, - neighbourhood_noise_complaints_per_1000 = `Rate of Noise Complaints per 1,000 population` +noise_complaints <- noise_complaints_raw |> + select(ltla24_name = Council, + noise_complaints_per_1k = "Complaints per 1000") |> + mutate( + ltla24_name = str_replace_all(ltla24_name, "\\s*City\\b", ""), + ltla24_name = case_when( + ltla24_name == "Ards and North Down" ~ "North Down and Ards", + TRUE ~ ltla24_name + ) ) -write_rds(noise, "data/vulnerability/health-inequalities/northern-ireland/healthy-places/neighbourhood-noise.rds") \ No newline at end of file + +# LA ID +lookup <- lookup_sa11_soa11_lgd18 |> + select(lgd18_name, lgd18_code) |> + distinct(lgd18_name, lgd18_code) |> + select (ltla24_name = lgd18_name, + ltla24_code = lgd18_code) + +# Join datasets +places_noise_complaints <- noise_complaints |> + left_join(lookup) |> + mutate(ltla24_code = if_else(ltla24_name == "Armagh, Banbridge and Craigavon", + "N09000002", ltla24_code)) + + + + + +identical(noise_complaints$ltla24_name, lookup$ltla24_name) +mismatched_rows <- which(noise_complaints$ltla24_name != lookup$ltla24_name) +noise_complaints[mismatched_rows, "ltla24_name"] +lookup[mismatched_rows, "ltla24_name"] + From b7e0627d17a7ab1abc21c163de98cc8870268da9 Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 14 Jan 2025 16:36:12 +0000 Subject: [PATCH 66/78] First draft completed - life-expectancy First draft completed - life-expectancy, styled and rendered. Average calculated between men and women. --- R/data.R | 16 ++ .../healthy-people/healthy-life-expectancy.R | 174 +++--------------- data/people_life_expectancy.rda | Bin 0 -> 457 bytes man/people_life_expectancy.Rd | 27 +++ metadata.md | 2 +- 5 files changed, 72 insertions(+), 147 deletions(-) create mode 100644 data/people_life_expectancy.rda create mode 100644 man/people_life_expectancy.Rd diff --git a/R/data.R b/R/data.R index 327711a..9015d6d 100644 --- a/R/data.R +++ b/R/data.R @@ -216,6 +216,22 @@ #' @source \url{https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4} "people_happiness" +#' Average Life Expectancy for Men and Women (2020-2022) +#' +#' A dataset containing statistics on average life expectancy for men +#' and women, by Northern Irish Council (2020-2022). +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{life_expectancy_combined}{Average life expectancy for men and women} +#' \item{year}{Time period - three year aggregate} +#' +#' ... +#' } +#' @source \url{https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/healthandlifeexpectancies/datasets/lifeexpectancyforlocalareasinenglandnorthernirelandandwalesbetween2001to2003and2020to2022} +"people_life_expectancy" + #' Average Measurement of Life Worthwhileness Out of 10 (2022-23) #' #' A dataset containing statistics of personal ratings on feelings of diff --git a/data-raw/healthy-people/healthy-life-expectancy.R b/data-raw/healthy-people/healthy-life-expectancy.R index 3e9ee35..5d9884a 100644 --- a/data-raw/healthy-people/healthy-life-expectancy.R +++ b/data-raw/healthy-people/healthy-life-expectancy.R @@ -1,7 +1,6 @@ # ---- Load packages ---- library(tidyverse) library(readxl) -library(geographr) # ---- Get and clean data ---- # Life Expectancy (2020-2022) @@ -17,162 +16,45 @@ le_raw <- read_excel(temp_file, sheet = 5, skip = 11) # Life Expectancy (Male) male_le <- le_raw |> - filter(Sex == "Male", - str_starts(`Area code`, "N"), - `Age group` == "<1", - `Area code` != "N92000002") |> - select(ltla24_code = `Area code`, - life_expectancy_male = `Life expectancy (years)...62`) - -# Life Expectancy (Female) - -female_le <- le_raw |> - filter(Sex == "Female", - str_starts(`Area code`, "N"), - `Age group` == "<1", - `Area code` != "N92000002") |> - select(ltla24_code = `Area code`, - life_expectancy_female = `Life expectancy (years)...62`) - - -# Join datasets -people_life_expectancy <- male_le |> - left_join(female_le, by = "ltla24_code") - - - -# TO DO: add in population data (from NISRA: 'Population totals, MYE01T06' OR -# 'Mid-year population estimates, MYE01T04 - probably this one). -# -# Then need to get population totals for males and females. Then combine male -# and female population to get total population for each council. -# -# Then need to calculate the weighted life expectancy - -# ((male-LE * male-pop) + (female-LE * female-pop)) / total-pop - - - -# ---- Load libraries ---- -library(tidyverse) -library(httr) -library(readxl) -library(geographr) -library(sf) - -source("R/utils.R") - -# ---- Retrieve data ---- -GET( - "https://www.ons.gov.uk/file?uri=%2fpeoplepopulationandcommunity%2fhealthandsocialcare%2fhealthandlifeexpectancies%2fdatasets%2fhealthstatelifeexpectancyatbirthandatage65bylocalareasuk%2fcurrent/hsleatbirthandatage65byukla201618.xlsx", - write_disk(tf <- tempfile(fileext = ".xlsx")) -) - -raw_males <- - read_excel( - tf, - sheet = "HE - Male at birth", - range = "A4:I490" - ) - -hle_males <- - raw_males |> - select( - lad_code = `Area Codes`, - healthy_life_expectancy_male = HLE + filter( + Sex == "Male", + str_starts(`Area code`, "N"), + `Age group` == "<1", + `Area code` != "N92000002" ) |> - filter_codes(lad_code, "^N") - -raw_females <- - read_excel( - tf, - sheet = "HE - Female at birth", - range = "A4:I490" - ) - -hle_females <- - raw_females |> select( - lad_code = `Area Codes`, - healthy_life_expectancy_female = HLE - ) |> - filter_codes(lad_code, "^N") - -hle_joined <- - hle_males |> - left_join(hle_females) - -# ---- Calculate female/male weighted population estimates ---- -GET( - "https://www.ons.gov.uk/file?uri=/peoplepopulationandcommunity/populationandmigration/populationestimates/datasets/populationestimatesforukenglandandwalesscotlandandnorthernireland/mid2019april2020localauthoritydistrictcodes/ukmidyearestimates20192020ladcodes.xls", - write_disk(tf <- tempfile(fileext = ".xls")) -) - -# Total pop -raw_pop_total <- - read_excel( - tf, - sheet = "MYE2 - Persons", - range = "A5:D431" + ltla24_code = `Area code`, + life_expectancy_male = `Life expectancy (years)...62` ) -pop_total <- - raw_pop_total |> - select( - lad_code = Code, pop_total = `All ages` - ) |> - filter_codes(lad_code, "^N") - -# Males -raw_pop_male <- - read_excel( - tf, - sheet = "MYE2 - Males", - range = "A5:D431" - ) +# Life Expectancy (Female) -pop_male <- - raw_pop_male |> - select( - lad_code = Code, pop_male = `All ages` +female_le <- le_raw |> + filter( + Sex == "Female", + str_starts(`Area code`, "N"), + `Age group` == "<1", + `Area code` != "N92000002" ) |> - filter_codes(lad_code, "^N") - -# Females -raw_pop_female <- - read_excel( - tf, - sheet = "MYE2 - Females", - range = "A5:D431" + select( + ltla24_code = `Area code`, + life_expectancy_female = `Life expectancy (years)...62` ) -pop_female <- - raw_pop_female |> - select( - lad_code = Code, pop_female = `All ages` - ) |> - filter_codes(lad_code, "^N") -# Calculate proportions -pop_proportions <- - pop_total |> - left_join(pop_male) |> - left_join(pop_female) |> +# Join datasets +people_life_expectancy <- male_le |> + left_join(female_le, by = "ltla24_code") |> rowwise() |> mutate( - proportion_male = pop_male / pop_total, - proportion_female = pop_female / pop_total + life_expectancy_combined = (life_expectancy_male + life_expectancy_female) / 2, + year = "2020-2022" ) |> - ungroup() |> - select(lad_code, starts_with("proportion")) - -# Compute population weighted mean HLE -hle <- - hle_joined |> - left_join(pop_proportions) |> - rowwise(lad_code) |> - summarise( - healthy_life_expectancy = (healthy_life_expectancy_male * proportion_male) + (healthy_life_expectancy_female * proportion_female), - .groups = "drop" + select( + ltla24_code, + life_expectancy_combined, + year ) -write_rds(hle, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/healthy-life-expectancy.rds") +# ---- Save output to data/ folder ---- +usethis::use_data(people_life_expectancy, overwrite = TRUE) diff --git a/data/people_life_expectancy.rda b/data/people_life_expectancy.rda new file mode 100644 index 0000000000000000000000000000000000000000..87b98bf4d9100912dddf3045d9625e3e19aa7b0b GIT binary patch literal 457 zcmV;)0XF_ZT4*^jL0KkKS$Y?qH~<0Cf8YQ6O<@4z|Kmi#JVd{z-|#{JhyegV5C8yx zAP52humO>V(h{krifQQ7^vWc#Pl&YqT#Q4mDHR>49Mbs`ks z*k!kD-P+r|em$mz<>@vi0vIqYWkMl^7Lo*E3F-|<2w9+%05cEp`iKP&&`7gv zjN-bMk9}&kDyc${DUhUvEU7jX*)o!*bu^UZQc72%u{;E#WhJUbzF)lg`#Qf%9mI}! zrB92ki%LJCT&VE9WU?1(NoXK literal 0 HcmV?d00001 diff --git a/man/people_life_expectancy.Rd b/man/people_life_expectancy.Rd new file mode 100644 index 0000000..c07a885 --- /dev/null +++ b/man/people_life_expectancy.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{people_life_expectancy} +\alias{people_life_expectancy} +\title{Average Life Expectancy for Men and Women (2020-2022)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{life_expectancy_combined}{Average life expectancy for men and women} +\item{year}{Time period - three year aggregate} + +... +} +} +\source{ +\url{https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/healthandlifeexpectancies/datasets/lifeexpectancyforlocalareasinenglandnorthernirelandandwalesbetween2001to2003and2020to2022} +} +\usage{ +people_life_expectancy +} +\description{ +A dataset containing statistics on average life expectancy for men +and women, by Northern Irish Council (2020-2022). +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 9641652..9e328fe 100644 --- a/metadata.md +++ b/metadata.md @@ -36,7 +36,7 @@ | Healthy People | Suicides | 2019 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data unavailable - contact info@nisra.gov.uk and ask for Deaths by Cause (administrative geographies) | :x: | | Healthy People | Avoidable Deaths | 2015-19 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data unavailable - contact healthinequalities@health-ni.gov.uk and ask for Standardised Death Rate - Avoidable (administrative geographies) | :x: | | Healthy People | Mortality from All Causes | 2020-22 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Age/sex-standardised all mortality rates per 100k | :heavy_check_mark: | -| Healthy People | Healthy Life Expectancy | 2016-2018 | [ONS](https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/healthandlifeexpectancies/datasets/healthstatelifeexpectancyatbirthandatage65bylocalareasuk) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: | :heavy_check_mark: | +| Healthy People | Life Expectancy | 2020-2022 | [ONS](https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/healthandlifeexpectancies/datasets/lifeexpectancyforlocalareasinenglandnorthernirelandandwalesbetween2001to2003and2020to2022) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Average healthy life expectancy for men and women combined. | :heavy_check_mark: | | Healthy People | Happiness | 2022-23 | [ONS](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Average personal ratings on feelings of happiness out of 10.| :heavy_check_mark: | | Healthy People | Anxiety | 2022-23 | [ONS](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Average personal ratings on feelings of anxiety out of 10. | :heavy_check_mark: | | Healthy People | Life Satisfaction | 2022-23 | [ONS](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Average personal ratings on feelings of life satisfaction out of 10.| :heavy_check_mark: | From 0d17a7701eeee1afafb89a48c3438d84dfeca4b7 Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 15 Jan 2025 14:32:32 +0000 Subject: [PATCH 67/78] Updated code for suicides Updated code for suicides. Have gone with 3-year aggregate that takes most recent 3 years and done a mean average. --- R/data.R | 4 ++-- data-raw/healthy-people/suicides.R | 2 +- data/people_suicide.rda | Bin 307 -> 297 bytes man/people_suicide.Rd | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/R/data.R b/R/data.R index e1f5e03..1b757e5 100644 --- a/R/data.R +++ b/R/data.R @@ -316,8 +316,8 @@ #' @format A data frame with 11 rows and 3 variables: #' \describe{ #' \item{ltla24_code}{Local Authority Code} -#' \item{suicide_rate_per_100k}{Deaths from suicide (16+). -#' Age standardised rate per 100,000.} +#' \item{suicide_rate_per_100k}{Deaths from suicide (16+). Age standardised +#' rate per 100,000.} #' \item{year}{Time period - 3 year aggregate} #' #' ... diff --git a/data-raw/healthy-people/suicides.R b/data-raw/healthy-people/suicides.R index 658442b..e525842 100644 --- a/data-raw/healthy-people/suicides.R +++ b/data-raw/healthy-people/suicides.R @@ -30,7 +30,7 @@ suicides_hb <- suicides_raw |> pivot_longer(cols = `Belfast`:`Western`, names_to = "trust18_name", values_to = "suicide_rate_per_100k") |> mutate(suicide_rate_per_100k = as.numeric(suicide_rate_per_100k)) |> group_by(trust18_name) |> - mutate(aggregate_suicide_rate_per_100k = sum(suicide_rate_per_100k, na.rm = TRUE)) |> + mutate(aggregate_suicide_rate_per_100k = (sum(suicide_rate_per_100k, na.rm = TRUE)) / 3) |> ungroup() |> select( trust18_name, diff --git a/data/people_suicide.rda b/data/people_suicide.rda index dcb5de270428d45e270c0f4bb6483bf86b9c3b28..aeb92442dd563a9cd5c0d55176261fce98723502 100644 GIT binary patch literal 297 zcmV+^0oMLPT4*^jL0KkKSrZAt{Qv!c0h309(9{g3h?tmw05k@G0MOB)ph-bM0B8UJGynhqAPzkY0*i_O zln^AA(FCopbn`+(N&$+U*;W82pI8X-L{*0SU4srRc{0N;wyZ4FwPsAu-zoR!HM6wA29fhRG5)q&?0^qa%wVBsy*cjj0bvKLcUa z5b+_RLi1L`It8ezN68WGl030Qej_FfUzQ|&5wZi!N0~wLrs@Jh8sOl^3WrlO8BnEb vmKCWoBMIdsp|5dk*WVm~fPfQ;#^55^7&QVzIxoZs7x8x_Q-uiuFq|LI=;d*1 literal 307 zcmV-30nGkFT4*^jL0KkKSqQtK=l}sT|MLGkN+19Of8k6C5MaMA-k?AL05Aan03ZSZ zumJWLG*cAXnrIC@Kr{dV(?HRusp$hrsSJ$K4K!j60Lai}G7nJo0xAhcYHdT*(9j-8 z@`0hF)BpfrHE}5ow15bVB>P}93be-ssnQlu1%xi&h5!Uq^~z$@6E*yCm6qq^<+}Wy zRYxshWCG9v0EWr-gjOhRlL<6JFa#Yn#2R7J=!7>^!|OFj1k{c(PUR;lDP2Agp-EMp zPQ@msN(@j;YE4ZcabyC51cL}PseX?9Ij*+X<}>#vFImug32;J*%@eFXbpEs`CtxQD z+#Dltg%D%RONmTm(J^YUoJg3|mc7ZZUwlC)Nl1ZE9YK(gfYv(?$OaGiyOJrwgn&ie F4?u(|d~N^$ diff --git a/man/people_suicide.Rd b/man/people_suicide.Rd index 2059bb5..11354a9 100644 --- a/man/people_suicide.Rd +++ b/man/people_suicide.Rd @@ -8,8 +8,8 @@ A data frame with 11 rows and 3 variables: \describe{ \item{ltla24_code}{Local Authority Code} -\item{suicide_rate_per_100k}{Deaths from suicide (16+). -Age standardised rate per 100,000.} +\item{suicide_rate_per_100k}{Deaths from suicide (16+). Age standardised +rate per 100,000.} \item{year}{Time period - 3 year aggregate} ... From 1f22b32fa48a1a7f58fc9fc79188381b1974c752 Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 15 Jan 2025 15:24:36 +0000 Subject: [PATCH 68/78] First draft completed - noise-complaints First draft completed - noise-complaints, styled and rendered. --- R/data.R | 17 ++++++++++ data-raw/healthy-places/noise-complaints.R | 36 ++++++++++----------- data/places_noise_complaints.rda | Bin 0 -> 353 bytes man/places_noise_complaints.Rd | 27 ++++++++++++++++ metadata.md | 2 +- 5 files changed, 63 insertions(+), 19 deletions(-) create mode 100644 data/places_noise_complaints.rda create mode 100644 man/places_noise_complaints.Rd diff --git a/R/data.R b/R/data.R index 327711a..23ec003 100644 --- a/R/data.R +++ b/R/data.R @@ -267,6 +267,23 @@ #' @source \url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} "people_mental_health" +#' Rates of Noise Complaints per 1,000 (2023-2024) +#' +#' A dataset containing statistics on noise complaints per 1,000 people in +#' Northern Irish Council Areas. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{noise_complaints_per_1k}{Number of noise complaints per 1,000 people} +#' \item{year}{Year} +#' +#' ... +#' } +#' @source https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF +#' +"places_noise_complaints" + #' Rates of Personal Crime per 1,000 (2017) #' #' A dataset containing statistics on 'personal crime' per 1,000 people in diff --git a/data-raw/healthy-places/noise-complaints.R b/data-raw/healthy-places/noise-complaints.R index 7a1a74c..866c38b 100644 --- a/data-raw/healthy-places/noise-complaints.R +++ b/data-raw/healthy-places/noise-complaints.R @@ -13,39 +13,39 @@ library(geographr) # Noise Complaints Data # Source: https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF -noise_complaints_raw <- read_excel("data-raw/healthy-places/noise_complaints_data.xlsx", skip = 4) +noise_complaints_raw <- read_excel("data-raw/healthy-places/noise_complaints_data.xlsx") noise_complaints <- noise_complaints_raw |> - select(ltla24_name = Council, - noise_complaints_per_1k = "Complaints per 1000") |> + select( + ltla24_name = Council, + noise_complaints_per_1k = "Complaints per 1000" + ) |> mutate( - ltla24_name = str_replace_all(ltla24_name, "\\s*City\\b", ""), + ltla24_name = str_replace_all(ltla24_name, "\\s*&\\s*", " and "), ltla24_name = case_when( ltla24_name == "Ards and North Down" ~ "North Down and Ards", TRUE ~ ltla24_name ) ) - # LA ID lookup <- lookup_sa11_soa11_lgd18 |> select(lgd18_name, lgd18_code) |> distinct(lgd18_name, lgd18_code) |> - select (ltla24_name = lgd18_name, - ltla24_code = lgd18_code) + select( + ltla24_name = lgd18_name, + ltla24_code = lgd18_code + ) # Join datasets places_noise_complaints <- noise_complaints |> left_join(lookup) |> - mutate(ltla24_code = if_else(ltla24_name == "Armagh, Banbridge and Craigavon", - "N09000002", ltla24_code)) - - - - - -identical(noise_complaints$ltla24_name, lookup$ltla24_name) -mismatched_rows <- which(noise_complaints$ltla24_name != lookup$ltla24_name) -noise_complaints[mismatched_rows, "ltla24_name"] -lookup[mismatched_rows, "ltla24_name"] + mutate(year = "2023-24") |> + select( + ltla24_code, + noise_complaints_per_1k, + year + ) +# ---- Save output to data/ folder ---- +usethis::use_data(places_noise_complaints, overwrite = TRUE) diff --git a/data/places_noise_complaints.rda b/data/places_noise_complaints.rda new file mode 100644 index 0000000000000000000000000000000000000000..e211403963a15aa506c104fcbb769450ea8b1472 GIT binary patch literal 353 zcmV-n0iOOsT4*^jL0KkKS!c@#jsO7`|NsAg-hlvPf8xY}FhsvE+^|9bfG`XJ06-7` z0DvI~0|BrB7+MV?k4PE=LqGrkGzNeG8X5D13=M`&;V)bWCBSO zNj*oY>TNX|44MI>CV&kL)MNkv91=@CQe1`voMt+kEO^He&HLXnAi+_;HSxRzx}GCL z4sj*xaGs{#<;%ObrKc{t=L<}d)BqU*sxnN1k3J{_6l~@JCyWUf{%Cq47-4~>_jAuo z7d9@v5!2;ngaK(HWQ++BSD5R9L+H&&ks~T01|Z;wTxC96I*a;JvABF-h#`e{stWD8 z!n*;pfR5n~8az+cNQpZI(#8ffA?W;s`Q0Fhv|ySfin&Nogp~UG2u% Date: Mon, 20 Jan 2025 16:03:33 +0000 Subject: [PATCH 69/78] First draft redone - cancer First draft redone - cancer, styled and rendered. data.R and metadata updated. --- data-raw/healthy-people/cancer.R | 27 +++++++++++++++++++++++++++ metadata.md | 3 +-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/data-raw/healthy-people/cancer.R b/data-raw/healthy-people/cancer.R index e69de29..fcdbd91 100644 --- a/data-raw/healthy-people/cancer.R +++ b/data-raw/healthy-people/cancer.R @@ -0,0 +1,27 @@ +# ---- Load packages ---- +library(tidyverse) + +# ---- Get and clean data ---- +# Cancer Data +# Source: https://data.nisra.gov.uk/ + +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/DISPREVLGD/CSV/1.0/" +cancer_raw <- read_csv(url) + +people_cancer <- cancer_raw |> + filter( + `Statistic Label` == "Raw disease prevalence per 1,000 patients", + `Disease` == "Cancer", + `Financial Year` == "2023/24", + `LGD2014` != "N92000002" + ) |> + rowwise() |> + mutate(cancer_percentage = VALUE / 10) |> + select( + ltla24_code = LGD2014, + cancer_percentage, + year = `Financial Year` + ) + +# ---- Save output to data/ folder ---- +usethis::use_data(people_cancer, overwrite = TRUE) diff --git a/metadata.md b/metadata.md index d168570..bb1a737 100644 --- a/metadata.md +++ b/metadata.md @@ -16,8 +16,7 @@ | Healthy Lives |Cardiovascular Conditions | 2023/24 | [NISRA](https://data.nisra.gov.uk/k) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data only available as separate conditions (CHD, COPD, Heart Failure 1 & 3, Stroke and TIA) as a rate per 1,000. To be comparable to England's Index must be shown as a %. To review at the end. | :x: | | Healthy Lives | High Blood Pressure | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. | :x: | | Healthy Lives | Overweight and Obesity in Adults | :x: | :x: | :x: | :x: - Data unavailable. | :x: | -| Healthy Lives | Cancer Screening | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | :x:| ❗: - The data (breast, bowel, and cervical cancers) is at the Health and Social Care Trusts level | :x: | -| Healthy Lives | Sexual Health | :x: | :x: | :x: | :x: - Data unavailable. | :x: | +| Healthy Lives | Cancer Screening | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage of people with cancer| :heavy_check_mark: | | Healthy Lives | Vaccination Coverage | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | :x: | ❗: - The data is at the Health and Social Care Trusts level | :x: | | Healthy Lives | Children in State Care | :x: | :x: | :x: | ❗: - Indicator not overtly present in England's HI. To review at the end (and likely remove) | :x: | | Healthy Lives | Infant Mortality | 2018-2022 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only present at HSC level| :x: | From 09843d9efd48eb33494d5c4885ffdcef7717e258 Mon Sep 17 00:00:00 2001 From: MikeJohnPage <38110953+MikeJohnPage@users.noreply.github.com> Date: Mon, 20 Jan 2025 17:06:11 +0100 Subject: [PATCH 70/78] Convert chr to dbl --- data-raw/healthy-lives/healthy-eating.R | 3 ++- data/lives_healthy_eating.rda | Bin 347 -> 348 bytes 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/data-raw/healthy-lives/healthy-eating.R b/data-raw/healthy-lives/healthy-eating.R index 6fbb69d..519fe46 100644 --- a/data-raw/healthy-lives/healthy-eating.R +++ b/data-raw/healthy-lives/healthy-eating.R @@ -54,7 +54,8 @@ lives_healthy_eating <- healthy_eating_hb |> healthy_eating_percentage, year ) |> - arrange(ltla24_code) + arrange(ltla24_code) |> + mutate(healthy_eating_percentage = as.numeric(healthy_eating_percentage)) # ---- Save output to data/ folder ---- usethis::use_data(lives_healthy_eating, overwrite = TRUE) diff --git a/data/lives_healthy_eating.rda b/data/lives_healthy_eating.rda index 1116dc73996933bb4b3e8796d73d861ccc899e1c..6556ae6fa162e8c006b8e457c79678f77073bd56 100644 GIT binary patch literal 348 zcmV-i0i*sxT4*^jL0KkKS%5jlbpQb-fA9ahY#_)9|KWrYF+soQ-Jrlg078HOpn(Dg zG5|smumKo0!&N;@jDP^qrhotg5ri5515G^;8mRRir>JPrpfnl)01Sg50BNJq00|_7 znLL_m4GjPWn2iQa4H*HT29G9@!AcsDkx^ht#BRZ=$E63$v*L{sFm*Of-v@w7{VJqX z1Xi`a?EVNV@Yu6zEEL@wfwajgpaURM43i*mIXuX701Kj{lEyH7SB2vt>PmkG7o`YN zD@cGfk{(FDkp7HAXF!o{B8o-ih@VKHGa>YeNqXAPZui@W8@uo=q+dBEFL%yy*rr{% zjrQU$91-h81qIT|Es?Y!93oJ63_Ka6g?IfD0y}_^nJ}pB)ETY>4ni^8;8r3e28m1d umJI}p>?Bl!O@XGGI literal 347 zcmV-h0i^yyT4*^jL0KkKS&Vje`v3u`f588`OdtRO|KJ1x5J11@-Jn1K0s*iAT7d?M zPbuh`q+}X2+Kn;*88poxzyLG=22B6}27pNvz)`7*gaByB)6@Vm94m_Z%yeK$(|j#Z z(*!RL8}CGzFm4t5xgZZm)lpC2nHA{Ulo1fmioIk__mA#qX3)|3=jsT5-~1&IXdASMtdSg`_iqcp<93=$z2 zxl$zw7ZnSM)gokINT^}0BVODo*TCDed>dJ_@OXT=5=m#>Tr t?g)j;78zvGfR%EwcB!W^goy0IK#*|lm|OSvz+nH2xgwk>NJcw5eSiTAi~Ilp From 4749e00657dd86b658b4b1be7b2d087aae699ac7 Mon Sep 17 00:00:00 2001 From: MikeJohnPage <38110953+MikeJohnPage@users.noreply.github.com> Date: Mon, 20 Jan 2025 17:35:14 +0100 Subject: [PATCH 71/78] Convert chr to dbl --- data-raw/healthy-lives/smoking.R | 3 ++- data/lives_smoking.rda | Bin 345 -> 343 bytes 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/data-raw/healthy-lives/smoking.R b/data-raw/healthy-lives/smoking.R index 0ba0ce5..240eb75 100644 --- a/data-raw/healthy-lives/smoking.R +++ b/data-raw/healthy-lives/smoking.R @@ -48,7 +48,8 @@ lives_smoking <- smoking_hb |> smoking_percentage, year ) |> - arrange(ltla24_code) + arrange(ltla24_code) |> + mutate(smoking_percentage = as.numeric(smoking_percentage)) # ---- Save output to data/ folder ---- usethis::use_data(lives_smoking, overwrite = TRUE) diff --git a/data/lives_smoking.rda b/data/lives_smoking.rda index 7204e69be8051a4e8cffb2dbace28f28f44ac909..12a3d0ba11ca6345f0e3c84123f966da71826a85 100644 GIT binary patch literal 343 zcmV-d0jT~$T4*^jL0KkKSsndlbpQb@|NsBLSp+~4|KOY<5J11L{h&e!00{sD5F{}H z1V8{F0s*iA7$h}KL(*v4L7|8M05kvq8fajTP&mnxMj@t#0%&4r(s!{9W3eS@UV#(Ff|*QAOS2j zZ4putEZfg!=S z_uiWSL$Jx6Fw92E3%#Q`3Bx4+r-~mhnL^9rT7lrHo34@z4~CrpVlttH&J$`aLMT9s p$c4B%yp{TO`WXP@D1ZNDlt8x`14vk5>Qy literal 345 zcmV-f0jB;!T4*^jL0KkKSy@Br8UO*Pf588`SO5S4|KJ1x5J11L-Jn1K0s*iAT7d?U zN2KzbO-zg+^oD={W~TK)jSUR|84Umc000t50+>mo)CP?jY3ga}28|gG3fXdI*ZLAch1Q z21$@O9G=c$2`#a56|9jYjJQQ32qbDqVIstgIl@U85FBzmCFqe=h2CRV129S;FwQI| zVWJ5bq+VPT86u&1wIX3IS%jESCNf2ghY%!nk{mir5h6e>91b6xr0D}ar3wW{g-V5L zNPFT=0a6nv8Hx&HMowgis1F`xts`DJU#rK<_3g8HvKyjDx0b;$YR>D_4O}G_7@9$N r%Gi5ZQX`zjOPEzlEs5xj0Y?y@;n3 Date: Mon, 20 Jan 2025 18:18:09 +0100 Subject: [PATCH 72/78] Update to use more idiomatic summarise call --- data-raw/healthy-people/suicides.R | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/data-raw/healthy-people/suicides.R b/data-raw/healthy-people/suicides.R index e525842..ca7eca6 100644 --- a/data-raw/healthy-people/suicides.R +++ b/data-raw/healthy-people/suicides.R @@ -29,14 +29,7 @@ suicides_hb <- suicides_raw |> slice(7:9) |> pivot_longer(cols = `Belfast`:`Western`, names_to = "trust18_name", values_to = "suicide_rate_per_100k") |> mutate(suicide_rate_per_100k = as.numeric(suicide_rate_per_100k)) |> - group_by(trust18_name) |> - mutate(aggregate_suicide_rate_per_100k = (sum(suicide_rate_per_100k, na.rm = TRUE)) / 3) |> - ungroup() |> - select( - trust18_name, - aggregate_suicide_rate_per_100k - ) |> - distinct(aggregate_suicide_rate_per_100k, .keep_all = TRUE) + summarise(aggregate_suicide_rate_per_100k = mean(suicide_rate_per_100k), .by = trust18_name) # Join datasets # Suicide data + Trust name and code From 30130fe298f1fa2715df7cb0bdca083573dca05b Mon Sep 17 00:00:00 2001 From: MikeJohnPage <38110953+MikeJohnPage@users.noreply.github.com> Date: Mon, 20 Jan 2025 18:35:55 +0100 Subject: [PATCH 73/78] Use idiomatic R way to calculate mean --- data-raw/healthy-people/healthy-life-expectancy.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-raw/healthy-people/healthy-life-expectancy.R b/data-raw/healthy-people/healthy-life-expectancy.R index 5d9884a..1d12816 100644 --- a/data-raw/healthy-people/healthy-life-expectancy.R +++ b/data-raw/healthy-people/healthy-life-expectancy.R @@ -47,7 +47,7 @@ people_life_expectancy <- male_le |> left_join(female_le, by = "ltla24_code") |> rowwise() |> mutate( - life_expectancy_combined = (life_expectancy_male + life_expectancy_female) / 2, + life_expectancy_combined = mean(c(life_expectancy_male, life_expectancy_female)), year = "2020-2022" ) |> select( From 363326494180af1692c7fc9c0c37fcbf0f422661 Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 21 Jan 2025 08:17:02 +0000 Subject: [PATCH 74/78] Updated .gitignore Removed line 51 --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5d090d6..7cc8b6a 100644 --- a/.gitignore +++ b/.gitignore @@ -48,4 +48,3 @@ po/*~ # RStudio Connect folder rsconnect/ .Rproj.user -*.xlsx From a7500a7c2b80c63980103ffa444c6aea84d8e4e4 Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 21 Jan 2025 08:31:21 +0000 Subject: [PATCH 75/78] Updated noise-complaints indicator Updated noise-complaints indicator. Added noise_complaints_data --- .../healthy-places/noise_complaints_data.xlsx | Bin 0 -> 9518 bytes data/places_noise_complaints.rda | Bin 353 -> 357 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 data-raw/healthy-places/noise_complaints_data.xlsx diff --git a/data-raw/healthy-places/noise_complaints_data.xlsx b/data-raw/healthy-places/noise_complaints_data.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..44378d3e91aabd81490a9bb3a9784a35e97d0a95 GIT binary patch literal 9518 zcmeHtg;!hI`gX9QghZHGVptwtMcMb0D?xDCtfzsmc?ph>JwCFFL znfuL5XTHDS-kr71URmcn?@IP7&)&~_0HTlq0DJ%% zqK1f-rM;o0y|$8zwV|CRlk*1)iX3D_+AIJf{Q3Wl|Kb&Z#`Vi~vH-;{ByU7EUPv!g z388Tw_;%ybzZGo%65CaxuaRMDdY=(|4HV8MG~=$s8(wf@J03Ktviwlz8`RaTfEDV~ z)2^&V%FX<>dmq$BL>yzQt_I5@AQfUI*47R;N(Cg@)ORXyh_1ethLV^NJ`(g^PoL{n z!CmfZ#41rQ;_aF5Sdmp(!sY2J9tWmIJEqr`4cy}3Kl)6ucnw;`C;PHYYS5Gs8D${* znCb)LN`7~Ss2ndhy{~6sPj3THyWD|3nY(4dDC!2X*yTOJIqq)LNxLwxx1EyOBk*9Q zXP3`ye`Hg`@9;Qb*Ng4$0RV7+j|7naTUypCvphS6$J!fs)?vcaQrp(h!j75g=kK4!AO5X}@_da08j452_pHvT43co|Efd7dmG?LzC= z8cAQ;P?QbsU4AA$ek@uE9A;7_LC4Q0gFF&Q_EGPWQCrfx{D?3qtawlcsi^19`W8E! z>NTBEu>0^;5bvA)v1Gy?J3ZsskM2DdlxIIklod^QO)K;=Y+q8jXd76xpNOWm;orKy zkWK4RpyI&0WE+;~24$Ujsn>8E_ousj;YRN)?K$f84Sia)1ZSv!CJ88{Dy#+x0ANN3 z0C3Qn7Q>OCoD zNqrI$wK1c@@nO47w(rA`3JY2)FVHIaQAD8A{Ko9jPMqea*3l(&yJ^`B8|DzBU;Tu!NcX7={-&9(`Q)!FNO%Q>7cuU9q< zn468gTY1%iO$igOxP9z59>p(FWo&8dYyk3;tHOwQ*TL|(<5jr0kb0|%9@^6L(VJ)7 z)1P>>PeK+C^36xQV8++{EKHQoG`1*$0JlL_QXGu&JBHiJH$Ok zKa=7ZujLzs>df-x5KUhn{j((fpn(WyYKXWWHjd{lbjx+$lul@M%J+8CrZ=lXNPC5$ zh9h!UdQo0eJsoWPRPQZ+4$;b5D;DH z>RsZ#laZF4Hjz4N_1^11MYh)@AG}0hF>hU%l|m)O9k}_#j3I@6vxN@js`Btogmq*= zbjAk=>#TTs|JX7J5{BBbY+~ARY3qn0)s{a@fdEvuX`p1H>>lj|C*|uVh$7hf8Thxb z$h>6>EueKM93=?6bB~Mo#-qi5 z#Q~8wh0J~NJhon2W2B(9jRm^os)da0(uy&4cqaL;+XP9;^}2Kxx0U*6ENjSUYu9hx z(HzkxE%_65v2hvq^!uLfk_z^l#)}9ff8-{^-;W4Kng7O+e@&h@;6sk!NlEU8HY_3d zJ*P61%4#F0nA>jKlP7afahbZOh4c8{X8oLy5GOK87d<{VF=k8d==8Wjqy3T)ezq=J86=z^)fO9p23+aavkYqMcUQ3&n#ci|+UzBK4VVL*Bg6XR zMuC&-YaRPhg-*&u%tkbaf#vsuM~_;{XM($C7lR?=R@41^_#eu*`U9``mDV?2rh^LS zpNEQl-?qK$w)Q`XL~ywBPpwNVX7AZpvx2AZKNH+XFfQ=~ey0h}f+PSm1bBk~PK19= z^Z$?{0(_4OFBAXW1F9ec{=x!m#k>n-aY}V0#GSQgrrKBD!$IqCZ%uE zd^ZJVMzVsqzy`Y=FF3K+knqns7>YvhkX`XDV0kq1^R20` zr%0hQ+PrTRnLmG!>Fe@z^n@5)ivOVtV034KlHsyL>>TZT%Z-tY%aD0T?iJQ1St*#j zgj2vBVowp+Bk|OWF2-&%C%IV}wrVeY-AC6p|DCb_6lS#1+da7q_w+wQh8g0czXIok zGE4yAG5m=?IKj@u(9qtF`L~JnCpo0Wf+JH|2m&tRubwi(g7t-Ce1*khRr#7rhHLei zIzqyW4_cJY+Aa{Kjq)sVq5+y=x9N7r$NRe$9K60KeN()fev}}2utt$<;&|pOuF>bx z?m!31nlj2lqN7vOyW`G%gT*CPfDc9XId7S;30qeSv>okL#lwlq{F!zTO1nrF3pILl1_qo5-$q2pOmIiq%9Ym3Ii5Z3AYMHWq=}j02%4cU z`<(Bmpl5JiRa%Cx5$=)cLPgEX*P_=Vp_*)YBil>63#~VNOp$z+0h^ao>+^4kKD_oq z>%`w$DVlreF7_2x{iT~*R&?b4gv zW4$=0N0>vI)1hAWf(!(Q*7Jlm@>{3L#th_&T$v6CSNSU&%M;W=2TmgtNLgrwd4tUY_0C!-OiZAMm81w0UH zOA#@i`>~$SK|l;l3`cm1A!~l44V%)XxW00FN^T1*hHDG+%3?*fByx1os869k7IBV- zWa|%K{pS7OE^+aTmVPW)0owU%2*PQvvT`Jmw2)czG#$o^nhp+(_2LMO;}e?uw&gu| zBhno`G!o`{77IS!y5GO_(88dV-Rrj3Jf5Bbg*s zUj((9Zc5v%JvM0yQmUcFT(xq%KCgl%T`@jaOijfxf8avJ@I8z-1&LIDC)~K29z6p2 zgIRKWG_p9yaUSZ+RFS|fA=S!_IyW~M)L@ak2>Zd@u&J#P!E0)0~OL<1Nr?u?Nb5Viso`W>`nw#F|SuYxq@m>^J4-_T* zFsOS5l`v?H{p>d=<9lgrKl_DwVQU8nDPvXcw-V2 zDbHgO)NsCTMfl$o3pw<&92_%wvzx{`$rSRHhcSO={?ma~bdqo6&SV&+hX)u`dZc6+ zDwWwr*i{v1``!$DSAxG|w&xT`V@Uk~fqpcyXo;KYNt@vY8AJ1;5;CjqQ+0GH~g%JExOus1RMV95O2^|yksuRa(_T2I)9+H)^7 zpgA?LTB+iLCZ=8m+xh%HUZ#-yU&l$ypoydz#HEVoDZ3HU18Gvo|PZIk# z5l>D=2IvyT5AyD4EvEg-Jdt$Fh`7!6?#l#`+N+8AO}p};>?Rzyj!F99to^a<=5Y)& zu1|Swb)CFB9M`&wV^%`RcUOn(5q!D2ou5hNAy)eiNb&MbgV>+VOXsK7mef89R&*5J3!jBr^I3&Z_;U!M~Vq014byrJDAOhUR&21rmhzj4JYpv z2X1^8|6J8R@Y+*2$*}9%Ip2C;fwzN|f%FEgv`6f_#S0_D1xfm&(-@WraXYGf@K&_< z_6y!yO30Tj`)gK>ZY~8{*TXRve_rNifj92JRUQZ10x6{~Px@g>QP!86eJHQC&M`(W zR#4OS9WE558J*e$aru3aRST4mgYFDLWS?5(8d}MxEqsC*`cFkI45u@)hIV$!6I4u| z;(k5?W#Ic}xPQ|b*)BFb@jdlJtLme)L776b=q~vr7v#?-HO<*f_dQ6O!C<&22DWO~ z@+rZ2iYK^ortk-Hi)Fx}QoEkLyz>{MZNnAxfbTeKUrpmA@a*G!-D>3aO#RDR!OLK$ zmX86OZQN@56-=3n_L{y}jg?r`=iGIJ$n566R5~-R!)N;F>MMvo ztUjO(gStL1=-ms+#AifqyKyng#8EkGAZ!D-Rx_8AX_eZZuX+a54g$+#6cOipE!Ub} ze6R$Q!tOuS%+@DZVW!OcZq;SkwEB8P`4$xEX0_0%3ltpV!w#+)Y4wfG27978%ATT^ zbDpqbrDVjJzOlUaHbqXna?wG=tS6Z1q3D>jDhe5*N)z^?WzihSA5dlnNjLh}MH6$~ zD%r}^n+le#=?f0er5Chq7}LbPBV6}HB9WWrsVPx{Sk`@iJ!mDeSfQDsvIp@_Xhjbm zGvEqN@e?&?za+tHvOD*DXHUjBr+(X|%vS&~(9G3MAmGkQTHJ#mA zSMwY%Y;ycMthWyrQ1(?*&WU5XHL@_13A2{_s7CBF4+xVX)&Dr2?#KYys?)_j;rj3u zp*8oJL!ouCm|Ut}H36lR7H5tRSY6jcvu<67Mco;{qejY1nrB-!rAGGRi_V#CfH!(Wre+0@rH2g zil^yD`(9mQuik5;lKqRZpgMa;OgcgEqap3^%Xz3^WkPOF zvLLdj$jPPK1Vf#5$sz+4&&am;?b?Cq%<_U6%U8?g% zYny0U(m+lDF>FgWz2@X?>YN)CO}bgmE^@Ih)qfn%s`<=s;jCzq?@K`ihmRHZP`~lK z`xRD9H&7N=m67kj2z?=Wj7@;Bt6ou1dpq%sQ83L(Ba?Ks(p?fGFkRcBbwrtWE3n&z zvmH+;HHAoJMrB0pVAj{Qx?ijsrI~Q3Z^rzrj7cg;$!7+wN2Wl z+^)6K<)cL?x#BB0*Q?t?a$+_kJ)hhkcbWn@?eXfW#g>4UpM;JKTfx^(`e6Mb%06yE741zZ4eB>Pm2U_ zvVZtH(c9U(SQy&<-1E06e=whC0p1DDcmb~t`yAI9(d)qD6Y@KKSx@#$_4bTMSjK2SSUaFXhgcA6O8 zg6Jg4Ac|CUstpqFdcMmEQFG$V)6mvh6s?;xHOxD_d)#YlQ~P#qq!v)}fg>AamRlVB z*8KeS%e_#Zm_%_6&1U>|P}4`3Uahh8Sl;YST=b}A2my#XEOT=yg_}wyNH=n!Kk%ex zs!vVnTbV6!gijH3$J*=N=gODQ`h?)~(O~QS%f)t> zIv=V)Vj*E6X<5-x?fmlNM^Uo9{tahVhu~YR=CbIyKH;WP`pzR)kI4(Lq`|v$=i9FJ z$WhmQTnntYd-6xMX9)Mk_0Lu=UKV$L5KR@|cdy6xn6W`|%*EqpXs0CH;N$A#_FO^R zx%I(Tw`#P0-x|ZOqjFH0maRJeV|A493W!poUYTMU(9B0>blGs%L;orMXyHM*+|Ao& zY^u)gvszVwl&i;3hv`R458Owmj14nVpcw>m0d|F>U+Q(L*WMMIfgOb z|Em^Srr9220>9JnGx+}qd=p(;Ljy&7TT@Hp-{RjOW>I#51sDKhID5jVO+nv516A^; zAXQ5EEb}8;om{7i7!Q2T<4j|5a{i{KxlEGDV=FazU7u*$%a0qDG$W=yTPAAhnZDi zM4*`^F6h!Cd3#$8ATed3Czs>arZFDtwr6uIM~mrbNV!>Lk;cqM7itmb_}y;b6(^@| z(8jt}ZL5E?p6>K9kU~Gs(nS{qj-pedjSj;7_>%1X*I+rkW2Fmz8t92>_{{-kT zOPQfDXh&{182Cj$X38DHcI&bUuQ~s6_V5b~9TS3kMi=fGT)2p3V5Ki_Yh`W6tZ!v& z_(y;Bf7%s%>B3@O%XLybhQMg<0wHeTUAFqDI&j)-FG$?js0H`34i^*T?Rb4L=2*&k zvVyym7#PUB5t>_)!(1Ud)g(kM^%gm0TKJoXj}~{Sa|G3P@*`*oC&3Of_KUvx)HKpQ zb4Uu^p@5p%|$KF43OpL$Y_0_)87u(ze< zl8NPrm3?-Je^ck_zMDY;UK|QRqPOdyt8aJz&<{EpWtWUzA2s4@58-XYu3nM?UKGBC zy~J#hZ42}b@&z88G50!Fxz9l5lk;aeWTn!gWnLB<$QF)YoPX2a*68pQNk_Sp88EVE zBgJL*X6shX%(?m34x+9UIxrX>cDQgc4EWcu)3vt#U(~_F?T?Wb^V(`2t{%aVuAX8o zlJYLfWBEY!Bvnr1?Yr89?lHnWJdZS1nLq)-HDhfFtve_GS zcq_)fED*18!3-@(j90nl60s3`ORHKEtSQhqClYrFXbZk5%RPNqmiy%L$j0dn7Id;c zuB94snQ&ED&8ufobm>{K5}y_tvRkL4U6q^56rWaaW*#2MiMrS2j0{?S@Qr++q9)vi zxb~arq+fm#roET*2i2U*55Na$(x)_h_(7Eq<|o2xLBW_lG$wcAl;d9(Twwb>E}J}VL6uNnfI}JX*a~Jl`MDl-0exT0sIiJ zc-9$U>@L~tY>uWi?INf&KV?w#14VXE@Zp4j727qX!D329;ML?w8w>y4`f2Ccch|R` zOg}V@*+I*9Rd;Zu_IJew0r3T#yZ-&nl>fNvKl8u5ry>vjyMe#=(EkJcIVZw%;x8Tb zUxB~&75{{`z*Fs)F5|D@zxOQugaQER7{7u4KOKx;?ffca|7mFi>;L_Tf5_UuTKQG@ z`qRo5@Ly%HUk&`aq5jjrFkD`Tuf?C+>tCV2Zb|-x_K^M#{dI%#tA)Q)=bv~0K<^0v o@DC#W75?`U_*eMs)4#y~D2Vc46u5T*01WuY8_v~9R6oD{AEK(@?*IS* literal 0 HcmV?d00001 diff --git a/data/places_noise_complaints.rda b/data/places_noise_complaints.rda index e211403963a15aa506c104fcbb769450ea8b1472..e912e0d8aa02054d5e3c27ba30fd2456f859a79c 100644 GIT binary patch delta 333 zcmV-T0kZz#0_6e~LRx4!F+o`-Q(4avd_@2OCx8F{|B)3Ve-e*K8UO$Q01W^D002Ee z)TWP9)G-4=ri}nH0B8UJ4H|kt2_!-xwKG#{Gz@?mWYMNgF&U@;2AXI%Gvm^bj(Y-5 zDLQJbdPM=#`{kmDSSL1a4)=hUUO7qe2-mg5=_~QYV$UV26Gy1|0<$ExfCfOR43i+I z?Q#%>M9yFme|W%=gYKKr0K*IoL+Q^w@mSun^lKzeo7ZMk0a+r7MkI(TQ9B(kGDdPn z1cK>q2!WZ9W<)JxSDy%4FQuv;?~D-yu)fv7TeVbHV0b_R_yu~|Lb?|sZXn^32Rq^9 zxQX$!!Xbl*sFD=(5W)m!oc#u{frx2K;oZbX@{tVRFB!QD3_N4J5At-(rDQT1ORb*L f(eKTEV3e$C{H`iN4P){`Ka05{oG3_Vi9RBLKmLos delta 329 zcmV-P0k;0-0^tG`LRx4!F+o`-Q(0%r2#x>&7XSbMe~}d001-wfB+gA z2dEm9X{V%VqfG$OkN^Wf(U8ypY3gJGNfSvuN2%&0iz~>4Gh#|000~kOFdFt zh6J2uI-4wb#}Uo@-!dSux zBPt;VAmE5xWj Date: Tue, 21 Jan 2025 10:16:47 +0100 Subject: [PATCH 76/78] Build docs --- man/people_dementia.Rd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/man/people_dementia.Rd b/man/people_dementia.Rd index 89e8128..a17c2cd 100644 --- a/man/people_dementia.Rd +++ b/man/people_dementia.Rd @@ -3,7 +3,8 @@ \docType{data} \name{people_dementia} \alias{people_dementia} -\title{Percentage of People with Dementia} +\title{A dataset containing statistics on the percentage of people medically +diagnosed with dementia, by Council (2023-24).} \format{ A data frame with 11 rows and 3 variables: \describe{ From 39cdb99230ac8819feb346080373dc5346868ff9 Mon Sep 17 00:00:00 2001 From: MikeJohnPage <38110953+MikeJohnPage@users.noreply.github.com> Date: Tue, 21 Jan 2025 10:17:03 +0100 Subject: [PATCH 77/78] Import tibble for default printing upon package load --- DESCRIPTION | 2 ++ NAMESPACE | 1 + R/data.R | 3 +++ 3 files changed, 6 insertions(+) diff --git a/DESCRIPTION b/DESCRIPTION index 82f4a69..9c0ff38 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -12,3 +12,5 @@ RoxygenNote: 7.3.2 Depends: R (>= 2.10) LazyData: true +Imports: + tibble diff --git a/NAMESPACE b/NAMESPACE index 6ae9268..e9a16ff 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,2 +1,3 @@ # Generated by roxygen2: do not edit by hand +importFrom(tibble,tibble) diff --git a/R/data.R b/R/data.R index a1d4e6a..06a1cce 100644 --- a/R/data.R +++ b/R/data.R @@ -1,3 +1,6 @@ +#' @importFrom tibble tibble +NULL + #' Percentage of Cancer Screening Uptake (2022-2023) #' #' A dataset containing statistics on the percentage of cancer screening uptake From 6235a1751db7c6a17d69ee6e2e269e6e52858785 Mon Sep 17 00:00:00 2001 From: MikeJohnPage <38110953+MikeJohnPage@users.noreply.github.com> Date: Tue, 21 Jan 2025 10:20:52 +0100 Subject: [PATCH 78/78] Remove whitespace causing rendering issues --- metadata.md | 1 - 1 file changed, 1 deletion(-) diff --git a/metadata.md b/metadata.md index cf9f159..95cf552 100644 --- a/metadata.md +++ b/metadata.md @@ -19,7 +19,6 @@ | Healthy Lives | Cancer Screening | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx)| heavy_check_mark: Indicator: Percentage of bowel, breast, and cervical cancer screening uptake. | :heavy_check_mark: | | Healthy Lives | Sexual Health | :x: | :x: | :x: | :x: - Data unavailable. | :x: | | Healthy Lives | Vaccination Coverage | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage of vaccine coverage in children 6 and under | :heavy_check_mark: | - | Healthy Lives | Children in State Care | :x: | :x: | :x: | ❗: - Indicator not overtly present in England's HI. To review at the end (and likely remove) | :x: | | Healthy Lives | Infant Mortality | 2018-2022 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Rate of infant mortality per 1k population| :heavy_check_mark: | | Healthy Lives | Low Birth Weight | 2022-23 | [Public Health Agency](https://www.publichealth.hscni.net/publications/statistical-profile-childrens-health-northern-ireland-202223) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage of infants born with low birth weight (<2,500g) | :heavy_check_mark: |