diff --git a/R/data.R b/R/data.R index 67908e4..4142bab 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 0000000..6fac82e Binary files /dev/null and b/data/lives_cancer_screening.rda differ 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 38306d5..51a7bd0 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_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_check_mark: Indicator: Percentage of adults with high blood pressure | :heavy_check_mark: | | Healthy Lives | Overweight and Obesity in Adults | :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 | 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: |