Skip to content

Commit

Permalink
Merge pull request #87 from nhs-r-community/add-getting-started
Browse files Browse the repository at this point in the history
Add getting started
  • Loading branch information
Lextuga007 authored Oct 1, 2024
2 parents 65400a6 + 779e414 commit 5293e8b
Show file tree
Hide file tree
Showing 16 changed files with 333 additions and 213 deletions.
2 changes: 1 addition & 1 deletion R/LOS_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' \item{Death}{Binary for death status: 0 = survived, 1= died in hospital}
#' }
#'
#' @source Generated by Chris Mainey \email{[email protected]}, Feb-2019
#' @source Generated by Chris Mainey, Feb-2019
#'
#' @usage data(LOS_model)
#'
Expand Down
23 changes: 16 additions & 7 deletions R/ae_attendances.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
#' in England for the years 2016/17 through 2018/19 (Apr-Mar). The data has been
#' tidied to be easily usable within the tidyverse of packages.
#'
#' Data sourced from \href{https://www.england.nhs.uk/statistics/statistical-work-areas/ae-waiting-times-and-activity/}{NHS England Statistical Work Areas}
#' which is available under the \href{https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/}{Open Government Licence v3.0}
#' Data sourced from
#' \href{https://www.england.nhs.uk/statistics/statistical-work-areas/ae-waiting-times-and-activity/}{NHS England Statistical Work Areas}
#' which is available under the
#' \href{https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/}{Open Government Licence v3.0}
#'
#' @docType data
#'
Expand All @@ -14,12 +16,18 @@
#' @format Tibble with six columns
#' \describe{
#' \item{period}{The month that this data relates to}
#' \item{org_code}{The \href{https://digital.nhs.uk/services/organisation-data-service}{ODS} code for this provider}
#' \item{type}{The \href{https://web.archive.org/web/20200128111444/https://www.datadictionary.nhs.uk/data_dictionary/attributes/a/acc/accident_and_emergency_department_type_de.asp}{department type}.
#' \item{org_code}{The
#' \href{https://digital.nhs.uk/services/organisation-data-service}{ODS}
#' code for this provider}
#' \item{type}{The
#' \href{https://web.archive.org/web/20200128111444/https://www.datadictionary.nhs.uk/data_dictionary/attributes/a/acc/accident_and_emergency_department_type_de.asp}{department type}.
#' either 1, 2 or other}
#' \item{attendances}{the number of patients who attended this department in this month}
#' \item{breaches}{the number of patients who breaches the 4 hour target in this month}
#' \item{admissions}{the number of patients admitted from A&E to the hospital in this month}
#' \item{attendances}{the number of patients who attended this department in
#' this month}
#' \item{breaches}{the number of patients who breaches the 4 hour target in
#' this month}
#' \item{admissions}{the number of patients admitted from A&E to the hospital
#' in this month}
#' }
#'
#' @source \href{https://www.england.nhs.uk/statistics/statistical-work-areas/ae-waiting-times-and-activity/}{NHS England Statistical Work Areas}
Expand All @@ -28,6 +36,7 @@
#'
#' @examples
#' data(ae_attendances)
#'
#' library(dplyr)
#' library(ggplot2)
#' library(scales)
Expand Down
14 changes: 10 additions & 4 deletions R/covid19.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,21 @@
#' library(scales)
#'
#' # Create a plot of the performance for England over time
#' covid19 %>%
#' covid19 |>
#' filter(countries_and_territories ==
#' c("United_Kingdom", "Italy", "France", "Germany", "Spain")) %>%
#' ggplot(aes(x = date_reported, y = cases, col = countries_and_territories)) +
#' c("United_Kingdom", "Italy", "France", "Germany", "Spain")) |>
#' ggplot(aes(
#' x = date_reported,
#' y = cases,
#' col = countries_and_territories
#' )) +
#' geom_line() +
#' scale_color_discrete("Country") +
#' scale_y_continuous(labels = comma) +
#' labs(
#' y = "Cases", x = "Date", title = "Covid-19 cases for selected countries",
#' y = "Cases",
#' x = "Date",
#' title = "Covid-19 cases for selected countries",
#' alt = "A plot of covid-19 cases in France, Germany, Italy, Spain & the UK"
#' ) +
#' theme_minimal()
Expand Down
23 changes: 16 additions & 7 deletions R/ons_mortality.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#' Deaths registered weekly in England and Wales, provisional
#'
#' Provisional counts of the number of deaths registered in England and Wales, by age, sex and region, in the latest weeks for which data are available.
#' Provisional counts of the number of deaths registered in England and Wales,
#' by age, sex and region, from week commencing 8th January 2010 to
#' 3rd April 202.
#'
#' Source and licence acknowledgement
#' This data has been made available through Office of National Statistics under the Open Government
#' Licence \url{http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/}
#'
#' This data has been made available through Office of National Statistics under
#' the Open Government Licence
#' \url{http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/}
#'
#'
#' @docType data
Expand All @@ -13,14 +17,19 @@
#'
#' @format Data frame with five columns
#' \describe{
#' \item{category_1}{character, containing the names of the groups for counts, for example "Total deaths", "all ages".}
#' \item{category_2}{character, subcategory of names of groups where necessary, for example details of region: "East", details of age bands "15-44".}
#' \item{counts}{numeric, numbers of deaths in whole numbers and average numbers with decimal points. To retain the integrity of the format this column data is left as character.}
#' \item{category_1}{character, containing the names of the groups for counts,
#' for example "Total deaths", "all ages".}
#' \item{category_2}{character, subcategory of names of groups where necessary,
#' for example details of region: "East", details of age bands "15-44".}
#' \item{counts}{numeric, numbers of deaths in whole numbers and average numbers
#' with decimal points. To retain the integrity of the format this column data
#' is left as character.}
#' \item{date}{date, format is yyyy-mm-dd; all dates are a Friday.}
#' \item{week_no}{integer, each week in a year is numbered sequentially.}
#' }
#'
#' @source Collected by Zoë Turner \email{[email protected]}, Apr-2020 from \url{https://www.ons.gov.uk/peoplepopulationandcommunity/birthsdeathsandmarriages/deaths/datasets/weeklyprovisionalfiguresondeathsregisteredinenglandandwales}
#' @source Collected by Zoë Turner, Apr-2020 from
#' \url{https://www.ons.gov.uk/peoplepopulationandcommunity/birthsdeathsandmarriages/deaths/datasets/weeklyprovisionalfiguresondeathsregisteredinenglandandwales}
#'
#' @usage data(ons_mortality)
#'
Expand Down
22 changes: 14 additions & 8 deletions R/stranded_patient_model.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#' Stranded Patient (Patients flagged as having a greater than 7 day LOS) Model
#'
#' This model is to be used as a machine learning classification model, for supervised learning. The binary outcome is stranded vs not stranded patients.
#' This model is to be used as a machine learning classification model, for
#' supervised learning. The binary outcome is stranded vs not stranded patients.
#'
#'
#' @docType data
Expand All @@ -12,23 +13,28 @@
#' \item{stranded.label}{Outcome variable - whether the patient is stranded or not}
#' \item{age}{Patient age on admission}
#' \item{care.home.referral}{Whether than have been referred from a care home}
#' \item{medicallysafe}{Medically safe for discharge - means the patient is assessed as safe, but has not been discharged yet}
#' \item{hcop}{Indicates whether they have been triaged from a Health Care for Older People specialty}
#' \item{mental_health_care}{Flag to indicate whether they need mental health support and care}
#' \item{medicallysafe}{Medically safe for discharge - means the patient is
#' assessed as safe, but has not been discharged yet}
#' \item{hcop}{Indicates whether they have been triaged from a Health Care for
#' Older People specialty}
#' \item{mental_health_care}{Flag to indicate whether they need mental health
#' support and care}
#' \item{periods_of_previous_care}{Count of the number of previous spells of care}
#' \item{admit_date}{Date they were admitted to hospital}
#' \item{frailty_index}{An initial index assessment to say if the patient is frail or not. This is needed for alignment of service provision.}
#' \item{frailty_index}{An initial index assessment to say if the patient is
#' frail or not. This is needed for alignment of service provision.}
#' }
#'
#' @source Synthetically generated by Gary Hutson, Mar-2021.
#'
#' @usage data(stranded_data)
#'
#' @examples
#' library(magrittr)
#' library(dplyr)
#' data("stranded_data")
#' stranded_data %>%
#'
#' data(stranded_data)
#'
#' stranded_data |>
#' glimpse()
#'
"stranded_data"
9 changes: 6 additions & 3 deletions R/synthetic_news_data.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#' Synthetic National Early Warning Scores Data
#'
#' Synthetic NEWS data to show as the results of the NHSR_synpop package.
#' These datasets have been synthetically generated by this package to be utilised in the NHSRDatasets package.
#' These datasets have been synthetically generated by this package to be
#' utilised in the NHSRDatasets package.
#'
#' @docType data
#'
Expand All @@ -28,9 +29,11 @@
#' @usage data(synthetic_news_data)
#'
#' @examples
#' library(magrittr)
#'
#' library(dplyr)
#'
#' data("synthetic_news_data")
#' synthetic_news_data %>%
#'
#' synthetic_news_data |>
#' glimpse()
"synthetic_news_data"
8 changes: 4 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ knitr::opts_chunk$set(
)
```

# NHS-R Community Datasets <a href='https://nhsrcommunity.com/'><img src='https://nhs-r-community.github.io/assets/logo/nhsr-logo.png' align="right" height="60" /></a>
# NHS-R Community Datasets <a href='https://nhsrcommunity.com/'><img src='https://nhs-r-community.github.io/assets/logo/nhsr-logo.png' align="right" height="60" style="float:right; height:200px;"/></a>

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-34-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/github/all-contributors/projectOwner/projectName?color=ee8449&style=flat-square)](#contributors)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

<!-- badges: start -->
Expand Down Expand Up @@ -50,8 +50,8 @@ To install the development version from [GitHub](https://github.com/) with:
remotes::install_github("nhs-r-community/NHSRdatasets")
```

Once installed go to the Getting Started article from the [website](https://nhs-r-community.github.io/NHSRdatasets) and the same link can
be found on the top right of the GitHub Repository.
Once installed go to the Get Started article from the [website](https://nhs-r-community.github.io/NHSRdatasets) (the same link can
be found on the top right of the GitHub Repository).

## Datasets available

Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@

# NHS-R Community Datasets <a href='https://nhsrcommunity.com/'><img src='https://nhs-r-community.github.io/assets/logo/nhsr-logo.png' align="right" height="80" /></a>
# NHS-R Community Datasets <a href='https://nhsrcommunity.com/'><img src='https://nhs-r-community.github.io/assets/logo/nhsr-logo.png' align="right" height="60" style="float:right; height:200px;"/></a>

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All
Contributors](https://img.shields.io/github/all-contributors/projectOwner/projectName?color=ee8449&style=flat-square)](#contributors)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

<!-- badges: start -->

Expand Down
Loading

0 comments on commit 5293e8b

Please sign in to comment.