From 339bd2240538a6f6e7000bf73f65ac43c2e08bbe Mon Sep 17 00:00:00 2001 From: Fran Barton Date: Mon, 5 Aug 2024 20:54:19 +0100 Subject: [PATCH 1/9] replace colon-style integer sequences with seq() calls --- tests/testthat/test-ptd_create_ggplot.R | 53 ++++++++++++------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/tests/testthat/test-ptd_create_ggplot.R b/tests/testthat/test-ptd_create_ggplot.R index c900941..ec70403 100644 --- a/tests/testthat/test-ptd_create_ggplot.R +++ b/tests/testthat/test-ptd_create_ggplot.R @@ -31,7 +31,7 @@ test_that("it calls ptd_validate_plot_options", { try( ptd_create_ggplot( - ptd_spc(data.frame(x = Sys.Date() + 1:20, y = rnorm(20)), "y", "x"), + ptd_spc(data.frame(x = Sys.Date() + seq(20L), y = rnorm(20L)), "y", "x"), "point_size", "percentage_y_axis", "main_title", @@ -76,7 +76,7 @@ test_that("it calls ptd_validate_plot_options", { test_that("it returns a ggplot object", { set.seed(123) - d <- data.frame(x = as.Date("2020-01-01") + 1:20, y = rnorm(20)) + d <- data.frame(x = as.Date("2020-01-01") + seq(20L), y = rnorm(20L)) s <- ptd_spc(d, "y", "x") p <- ptd_create_ggplot(s) @@ -101,8 +101,8 @@ test_that("it facets the plot if facet_field is set", { set.seed(123) d <- data.frame( x = as.Date("2020-01-01") + 1:20, - y = rnorm(20), - g = rep(c(1, 2), each = 10) + y = rnorm(20L), + g = rep(c(1L, 2L), each = 10L) ) withr::with_options(list(ptd_spc.warning_threshold = 10), { @@ -121,7 +121,7 @@ test_that("it sets the x_axis_breaks correctly", { stub(ptd_create_ggplot, "ggplot2::scale_x_datetime", m) set.seed(123) - d <- data.frame(x = as.POSIXct("2020-01-01") + 1:20, y = rnorm(20)) + d <- data.frame(x = as.POSIXct("2020-01-01") + seq(20L), y = rnorm(20L)) s <- ptd_spc(d, "y", "x") attr(d$x, "tzone") <- "" @@ -141,7 +141,7 @@ test_that("it sets the x_axis_breaks correctly", { test_that("it sets x_axis_label correctly", { set.seed(123) - d <- data.frame(x = as.Date("2020-01-01") + 1:20, y = rnorm(20)) + d <- data.frame(x = as.Date("2020-01-01") + seq(20L), y = rnorm(20L)) s <- ptd_spc(d, "y", "x") p1 <- ptd_create_ggplot(s) @@ -153,7 +153,7 @@ test_that("it sets x_axis_label correctly", { test_that("it sets y_axis_label correctly", { set.seed(123) - d <- data.frame(x = as.Date("2020-01-01") + 1:20, y = rnorm(20)) + d <- data.frame(x = as.Date("2020-01-01") + seq(20L), y = rnorm(20L)) s <- ptd_spc(d, "y", "x") p1 <- ptd_create_ggplot(s) @@ -166,9 +166,9 @@ test_that("it sets y_axis_label correctly", { test_that("it sets scales correctly in a faceted plot", { set.seed(123) d <- data.frame( - x = as.Date("2020-01-01") + 1:20, - y = rnorm(20), - g = rep(c(1, 2), each = 10) + x = as.Date("2020-01-01") + seq(20L), + y = rnorm(20L), + g = rep(c(1L, 2L), each = 10L) ) withr::with_options(list(ptd_spc.warning_threshold = 10), { @@ -198,7 +198,7 @@ test_that("it sets scales correctly in a faceted plot", { test_that("it creates a secondary y axis with percentage scales", { set.seed(123) - d <- data.frame(x = as.Date("2020-01-01") + 1:20, y = rnorm(20)) + d <- data.frame(x = as.Date("2020-01-01") + seq(20L), y = rnorm(20L)) s <- ptd_spc(d, "y", "x") sec_breaks <- s |> @@ -223,7 +223,7 @@ test_that("it creates a secondary y axis with percentage scales", { test_that("it creates a secondary y axis with integer scales", { set.seed(123) - d <- data.frame(x = as.Date("2020-01-01") + 1:20, y = rnorm(20)) + d <- data.frame(x = as.Date("2020-01-01") + seq(20L), y = rnorm(20L)) s <- ptd_spc(d, "y", "x") sec_breaks <- s |> @@ -245,7 +245,7 @@ test_that("it sets the y-axis to percentages if percentage_y_axis is TRUE", { m <- mock() stub(ptd_create_ggplot, "scales::label_percent", m) - d <- data.frame(x = as.Date("2020-01-01") + 1:20, y = rnorm(20)) + d <- data.frame(x = as.Date("2020-01-01") + seq(20L), y = rnorm(20L)) s <- ptd_spc(d, "y", "x") p1 <- ptd_create_ggplot(s, percentage_y_axis = TRUE) @@ -258,7 +258,7 @@ test_that("it sets the y-axis to percentages if percentage_y_axis is TRUE", { test_that("it sets the y-axis if y_axis_breaks is provided", { set.seed(123) - d <- data.frame(x = as.Date("2020-01-01") + 1:20, y = rnorm(20)) + d <- data.frame(x = as.Date("2020-01-01") + seq(20L), y = rnorm(20L)) s <- ptd_spc(d, "y", "x") p1 <- ptd_create_ggplot(s, y_axis_breaks = 1) @@ -270,7 +270,7 @@ test_that("it sets the y-axis if y_axis_breaks is provided", { test_that("it adds theme_override to the plot", { set.seed(123) - d <- data.frame(x = as.Date("2020-01-01") + 1:20, y = rnorm(20)) + d <- data.frame(x = as.Date("2020-01-01") + seq(20L), y = rnorm(20L)) s <- ptd_spc(d, "y", "x") p1 <- ptd_create_ggplot(s) @@ -286,7 +286,7 @@ test_that("it adds theme_override to the plot", { test_that("it breaks lines", { set.seed(123) - d <- data.frame(x = as.Date("2020-01-01") + 1:20, y = rnorm(20)) + d <- data.frame(x = as.Date("2020-01-01") + seq(20L), y = rnorm(20L)) withr::with_options(list(ptd_spc.warning_threshold = 10), { s <- ptd_spc(d, "y", "x", rebase = as.Date("2020-01-01") + 11) }) @@ -323,13 +323,10 @@ test_that("it sets the colour of the points based on the type", { stub(ptd_create_ggplot, "ggplot2::scale_colour_manual", m) set.seed(123) - d <- data.frame(x = as.Date("2020-01-01") + 1:20, y = rnorm(20)) |> + d <- data.frame(x = as.Date("2020-01-01") + seq(20L), y = rnorm(20L)) |> # introduce some special cause variation! dplyr::mutate( - across("y", \(y) dplyr::case_when( - x > "2020-01-15" ~ y + 0.5, - TRUE ~ y - )) + across("y", \(y) dplyr::if_else(.data[["x"]] > "2020-01-15", y + 0.5, y)) ) colours_neutral <- list( @@ -359,7 +356,7 @@ test_that("it sets the colour of the points based on the type", { }) test_that("it sets the main title correctly", { - d <- data.frame(x = as.Date("2020-01-01") + 1:20, y = rnorm(20), z = rnorm(20)) + d <- data.frame(x = as.Date("2020-01-01") + seq(20L), y = rnorm(20L), z = rnorm(20L)) s <- ptd_spc(d, "y", "x") p1 <- ptd_create_ggplot(s) @@ -370,7 +367,7 @@ test_that("it sets the main title correctly", { }) test_that("a plot with short rebase group has a warning caption", { - d <- data.frame(x = as.Date("2020-01-01") + 1:40, y = rnorm(40)) + d <- data.frame(x = as.Date("2020-01-01") + seq(40L), y = rnorm(40L)) # rebase at midpoint, no short groups s1 <- ptd_spc(d, "y", "x", rebase = as.Date("2020-01-20")) # rebase close to end of points @@ -395,8 +392,8 @@ test_that("it doesn't add icons if icons_position is 'none'", { set.seed(123) d <- data.frame( - x = as.Date("2020-01-01") + 1:20, - y = rnorm(20) + x = as.Date("2020-01-01") + seq(20L), + y = rnorm(20L) ) s1 <- ptd_spc(d, "y", "x", target = 0.5) @@ -411,8 +408,8 @@ test_that("it calls ptd_create_ggplot()", { set.seed(123) s <- ptd_spc( data.frame( - x = Sys.Date() + 1:20, - y = rnorm(20) + x = Sys.Date() + seq(20L), + y = rnorm(20L) ), "y", "x" ) @@ -435,7 +432,7 @@ test_that("it calls ptd_create_ggplot()", { x_axis_breaks = NULL, y_axis_breaks = NULL, limit_annotations = FALSE, - icons_size = 8L, + icons_size = 8, icons_position = c("top right", "bottom right", "bottom left", "top left", "none"), colours = "colours", theme_override = NULL, From df5095f6f79d03595d9eafaddcedbcb9e23d0427 Mon Sep 17 00:00:00 2001 From: Fran Barton Date: Mon, 5 Aug 2024 20:55:24 +0100 Subject: [PATCH 2/9] Reformat markdown in vignettes to keep to line length and new lines for new sentences --- vignettes/deviations.Rmd | 90 ++++++++++++-------- vignettes/intro.Rmd | 108 +++++++++++++----------- vignettes/number-of-points-required.Rmd | 33 ++++---- 3 files changed, 132 insertions(+), 99 deletions(-) diff --git a/vignettes/deviations.Rmd b/vignettes/deviations.Rmd index 9b70b98..e1cda53 100644 --- a/vignettes/deviations.Rmd +++ b/vignettes/deviations.Rmd @@ -8,6 +8,7 @@ vignette: > --- ```{r setup, include = FALSE} + knitr::opts_chunk$set( fig.width = 7, fig.height = 5, collapse = TRUE, @@ -17,46 +18,45 @@ library(dplyr) library(ggplot2) library(NHSRplotthedots) library(NHSRdatasets) + ``` -The overall intent of this package is to mimic as completely as possible the output available from the -[NHSEI Making Data Count][mdc] Excel tools. However, we have identified some areas where the R implementation -should deviate from the main Excel tools. We have done this only after careful consideration, and we believe there is a -benefit to deviating. +The overall intent of this package is to mimic as completely as possible the output available from the [NHSEI Making Data Count][mdc] Excel tools. +However, we have identified some areas where the R implementation should deviate from the main Excel tools. +We have done this only after careful consideration, and we believe there is a benefit to deviating. -This vignette documents what these differences are, and how to -set options to over-ride them, so that if you need to you can completely replicate the output that the Excel tools would create. +This vignette documents what these differences are, and how to set options to over-ride them, so that if you need to you can completely replicate the output that the Excel tools would create. -You may consider this important if for example you are publishing outputs from both the Excel tool and this R tool, and -need the outputs to be completely consistent. +You may consider this important if for example you are publishing outputs from both the Excel tool and this R tool, and need the outputs to be completely consistent. ## List of Deviations ### 1. Treatment of outlying points -By default, this package will screen outlying points, removing them from the moving range calculation, and hence from -the process limits calculation. This is in line with the published paper: +By default, this package will screen outlying points, removing them from the moving range calculation, and hence from the process limits calculation. +This is in line with the published paper: -> Nelson, LS, "Control Charts for Individual Measurements", Journal of Quality Technology, 1982, 14(34) +> Nelson, Lloyd S. (1982) Control Charts for Individual Measurements, _Journal of Quality Technology_ 14(3): 172-173 It is discussed further in the book: -> Lloyd P Provost & Sandra K Murray, The Health Care Data Guide: Learning from Data for Improvement (San Francisco, CA: Jossey-Bass, 2011), p.155 & p.192. +> Provost, Lloyd P. & Murray, Sandra K. (2011) _The Health Care Data Guide: Learning from Data for Improvement_, San Francisco, CA: Jossey-Bass, pp.155, 192 -The Making Data Count" Excel tools do not screen outlying points, and all points are included in the moving range and -limits calculations. If outlying points exist, the process limits on the Excel tools will therefore be wider than if -outlying points were screened from the calculation. +The "Making Data Count" Excel tools do not screen outlying points, and all points are included in the moving range and limits calculations. +If outlying points exist, the process limits on the Excel tools will therefore be wider than if outlying points were screened from the calculation. -This behaviour is controlled by the `screen_outliers` argument. By default, `screen_outliers = TRUE`. +This behaviour is controlled by the `screen_outliers` argument. +By default, `screen_outliers = TRUE`. To replicate the Excel method, set the argument `screen_outliers = FALSE`. The two charts below demonstrate the default, and how to over-ride to replicate the Excel tools. -**R Package Default:** +#### R Package Default: ```{r} + data <- c(1, 2, 1, 2, 10, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1) date <- seq(as.Date("2021-03-22"), by = 1, length.out = 18) df <- tibble::tibble(data, date) @@ -72,11 +72,13 @@ spc_data %>% ", LPL = ", round(spc_data$lpl[1], 2) ) ) + ``` -**Over-riding to replicate "Making Data Count" Excel output:** +#### Over-riding to replicate "Making Data Count" Excel output: ```{r} + # setting screen_outliers = FALSE produces the same output as Excel spc_data <- ptd_spc(df, value_field = data, date_field = date, screen_outliers = FALSE) spc_data %>% @@ -88,15 +90,19 @@ spc_data %>% ", LPL = ", round(spc_data$lpl[1], 2) ) ) + ``` + ### 2. Breaking of lines -By default, this package will break process and limit lines when a plot is rebased. The Excel tool draws all lines as -continuous lines. However, rebasing is a change to the process, so by breaking lines it more clearly indicates that a -change in process has happened. +By default, this package will break process and limit lines when a plot is rebased. +The Excel tool draws all lines as continuous lines. +However, rebasing is a change to the process, so by breaking lines it more clearly indicates that a change in process has happened. + +This can be controlled with the `break_lines` argument. +There are 4 possible values: -This can be controlled with the `break_lines` argument. There are 4 possible values: * "both" (default) * "limit" (to just break the limit lines, but leave the process line connected) * "process" (to just break the process line, but leave limit lines connected) @@ -104,57 +110,69 @@ This can be controlled with the `break_lines` argument. There are 4 possible val Examples of these 4 are shown below: -**R Package Default:** +#### R Package Default: ```{r} + spc_data <- ae_attendances %>% group_by(period) %>% summarise(across(attendances, sum)) %>% ptd_spc(attendances, period, rebase = as.Date(c("2017-04-01", "2018-04-01"))) plot(spc_data, break_lines = "both") + ``` -**just breaking the limit lines:** +#### Just breaking the limit lines: ```{r} + plot(spc_data, break_lines = "limits") + ``` -**just breaking the limit lines:** +#### Just breaking the process lines: ```{r} + plot(spc_data, break_lines = "process") + ``` -**Over-riding to replicate "Making Data Count" Excel output:** +#### Over-riding to replicate "Making Data Count" Excel output: ```{r} + plot(spc_data, break_lines = "none") + ``` ### 3. X Axis Text Angle -As can be seen in the plots above, by default this package will print x axis text rotated by 45 degrees for better utilisation of space, and readability. Excel's behaviour is to print this text at 90 degrees to the axis. +As can be seen in the plots above, by default this package will print x axis text rotated by 45 degrees for better utilisation of space, and readability. +Excel's behaviour is to print this text at 90 degrees to the axis. -Text angle can be over-ridden by passing a ggplot `theme()` into the `theme_override` argument of the plot function. Any of the modifications documented in the [ggplot2 theme documentation](https://ggplot2.tidyverse.org/reference/theme.html) can be made, but in this case we just need to modify `axis.text.x`. +Text angle can be over-ridden by passing a ggplot `theme()` into the `theme_override` argument of the plot function. +Any of the modifications documented in the + [ggplot2 theme documentation][gg_theme] + can be made, but in this case we just need to modify `axis.text.x`. -**To re-instate 90 degree axis text:** +#### To re-instate 90 degree axis text: ```{r} + ae_attendances %>% group_by(period) %>% summarise(across(attendances, sum)) %>% ptd_spc(attendances, period) %>% - plot( - theme_override = theme( - axis.text.x = element_text(angle = 90) - ) - ) + plot(theme_override = theme(axis.text.x = element_text(angle = 90))) + ``` ---- -Find the package code on [GitHub](https://github.com/nhs-r-community/NHSRplotthedots) +--- +Find the package code on [GitHub][ptd_gh]. [mdc]: https://www.england.nhs.uk/publication/making-data-count/ +[gg_theme]: https://ggplot2.tidyverse.org/reference/theme.html +[ptd_gh]: https://github.com/nhs-r-community/NHSRplotthedots diff --git a/vignettes/intro.Rmd b/vignettes/intro.Rmd index 3401da8..0766d5d 100644 --- a/vignettes/intro.Rmd +++ b/vignettes/intro.Rmd @@ -6,6 +6,7 @@ vignette: > %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- + ```{r message=FALSE, warning=FALSE, include=FALSE} knitr::opts_chunk$set( fig.width = 7, fig.height = 5, @@ -14,22 +15,23 @@ knitr::opts_chunk$set( ) ``` -Welcome to the NHS-R community's collaborative package for building a specific type of statistical process control (SPC) -chart, the XmR chart. We are aiming to support the NHS England's ['Making Data Count' programme][mdc], a programme which encourages boards, managers, and analyst teams to present data in -ways that show change over time, and drive better understanding of indicators than 'RAG' (red, amber, green) rated board -reports often present. +Welcome to the NHS-R community's collaborative package for building a specific type of statistical process control (SPC) chart, the XmR chart. +We are aiming to support the NHS England's + ['Making Data Count' programme][mdc], + a programme which encourages boards, managers, and analyst teams to present + data in ways that show change over time, and drive better understanding of + indicators than 'RAG' (red, amber, green) rated board reports often support. -This tutorial is a concise take on applying the function to some Accident and Emergency breach data for some NHS -hospitals. We'll take this from the `NHSRdatasets` package, another of our packages providing example datasets for -training in an NHS/healthcare context. +This tutorial is a concise take on applying the function to some Accident and Emergency breach data for some NHS hospitals. +We'll take this from the `NHSRdatasets` package, another of our packages providing example datasets for training in an NHS/healthcare context. -The analyses below use the `tidyverse` packages: `dplyr` to manipulate the data, and `ggplot2` for plotting (when not -using `NHSRplotthedots`). +The analyses below use the `tidyverse` packages: `dplyr` to manipulate the data, and `ggplot2` for plotting (when not using `NHSRplotthedots`). -Firstly, lets load the data, filter for University Hospital Birmingham NHS Foundation Trust, because they are a good -example for the type of charts below. Let's also do a simple timeseries plot to see why this is the case. +Firstly, let's load the data, filter for University Hospital Birmingham NHS Foundation Trust, because they are a good example for the type of charts below. +Let's also do a simple timeseries plot to see why this is the case. ```{r dataset, message=FALSE, warning=FALSE} + library(NHSRplotthedots) library(NHSRdatasets) library(dplyr) @@ -47,21 +49,22 @@ ae_attendances %>% scale_x_date("Date") + labs(title = "Example plot of A&E breaches for organsiation: 'RRK'") + theme_minimal() + ``` -This minimal plot shows the changes over time, and we will look at it in two ways. The first, we'll look at 2016/17 & -2017/18, which is apparently stable and, during 2018, the trust merged with another large 3-hospital provider trust, so -the numbers through A&E shot up dramatically when combined under one trust code. We can use a change point in our plots -to consider this. +This minimal plot shows the changes over time, and we will look at it in two ways. +The first, we'll look at 2016/17 & 2017/18, which is apparently stable and, during 2018, the trust merged with another large 3-hospital provider trust, so the numbers through A&E shot up dramatically when combined under one trust code. +We can use a change point in our plots to consider this. -Let's now use the `ptd_spc` function to draw our plot. We need to provide it with a `data.frame` that contains our data, -and provide a `value_field` for the y-axis, and a `date_field` for the x-axis. Remember to surround the names of the -columns in the `data.frame` with quotes (making it a string, see below). In addition, to ensure the points are coloured -correctly, we need to set the `improvement_direction` to "decrease", here (as fewer A&E breaches is better). +Let's now use the `ptd_spc` function to draw our plot. + +We need to provide it with a `data.frame` that contains our data, and provide a `value_field` for the y-axis, and a `date_field` for the x-axis. +In addition, to ensure the points are coloured correctly, we need to set the `improvement_direction` to "decrease", here (as fewer A&E breaches is better). ## Stable period ```{r stableperiod} + stable_set <- ae_attendances %>% filter( org_code == "RRK", @@ -75,22 +78,22 @@ ptd_spc( date_field = period, improvement_direction = "decrease" ) + ``` -From the chart above, we can see the centre line (mean) and the control limits calculated according the the XmR chart -rules. Our points that are between the control limits are within control and showing 'common-cause' or 'natural' -variation. We can see 8 sequential points coloured in blue. This is triggered by a rule that looks for >=7 points on one -side of the mean. This could be viewed as a period where fewer breaches than average were detected, which may hold some -learning value for the organisation. +From the chart above, we can see the centre line (mean) and the control limits calculated according the the XmR chart rules. +Our points that are between the control limits are within control and showing 'common-cause' or 'natural' variation. +We can see 8 sequential points coloured in blue. This is triggered by a rule that looks for >=7 points on one side of the mean. +This could be viewed as a period where fewer breaches than average were detected, which may hold some learning value for the organisation. ## Change point -From the first plot above, we can see that the change is noticed at 01/07/2019. We understand the reason for the change -(the merging of two trusts), and believe this will be the new normal range for the process, so it would be valid to -rebase at this point. To rebase (change the modelling period for control limits), we can pass a vector of dates at the -point we wish to rebase using the `ptd_rebase()` function. +From the first plot above, we can see that the change is noticed at 01/07/2019. +We understand the reason for the change (the merging of two trusts), and believe this will be the new normal range for the process, so it would be valid to rebase at this point. +To rebase (change the modelling period for control limits), we can pass a vector of dates at the point we wish to rebase using the `ptd_rebase()` function. ```{r changepoint} + change_set <- ae_attendances %>% filter(org_code == "RRK", type == 1) @@ -100,25 +103,27 @@ ptd_spc(change_set, improvement_direction = "decrease", rebase = ptd_rebase(as.Date("2018-07-01")) ) + ``` You can see that our limit calculation has now shifted at the rebase point. ## Faceting -In `{ggplot2}`, a `facet` refers to splitting or plotting by variables, into separate plots or regions. Imagine you want -to do an SPC for all trusts in a dataset, or all specialties at a trust. Facet will help you do this, and you can pass -the field that controls this to the `ptd_spc` argument `facet_field`. +In `{ggplot2}`, a `facet` refers to splitting or plotting by variables, into separate plots or regions. +Imagine you want to do an SPC for all trusts in a dataset, or all specialties at a trust. +Facet will help you do this, and you can pass the field that controls this to the `ptd_spc` argument `facet_field`. Here we will pick 6 trusts at random and plot their breaches, faceting across them. -We'll also combine this with a couple more options that are specific to the plot. This is done with the -`ptd_create_ggplot` function in the backend, but also works with the generic `plot`. To find out the available options, -see the help-file for: `?ptd_create_ggplot`. We will let the x-axis scale change for each plot for each plot (otherwise -some would look crushed against a larger trusts) and we will also change the x-axis breaks to 3-months, as 1 month -looked too busy.) +We'll also combine this with a couple more options that are specific to the plot. +This is done with the `ptd_create_ggplot` function in the backend, but also works with the generic `plot`. +To find out the available options, see the help-file for: `?ptd_create_ggplot`. + +We will let the x-axis scale change for each plot for each plot (otherwise some would look crushed against a larger trusts) and we will also change the x-axis breaks to 3-months, as 1 month looked too busy.) ```{r facetvignette} + facet_set <- ae_attendances %>% filter( org_code %in% c("RRK", "RJC", "RJ7", "R1K", "R1H", "RQM"), @@ -134,12 +139,14 @@ ptd_spc( improvement_direction = "decrease" ) %>% plot(fixed_y_axis_multiple = FALSE, x_axis_breaks = "3 months") + ``` -From this, the point-size seems too big, and it would be worth replacing the y-axis title with something better. Again, -this is done with the `plot` function arguments: +From this, the point-size seems too big, and it would be worth replacing the y-axis title with something better. +Again, this is done with the `plot` function arguments: ```{r facetvignette2} + facet_set <- ae_attendances %>% filter( org_code %in% c("RRK", "RJC", "RJ7", "R1K", "R1H", "RQM"), @@ -160,12 +167,13 @@ ptd_spc( point_size = 2, y_axis_label = "Number of 4-hour A&E target breaches" ) + ``` -As the plots are based on `{ggplot2}` you can override elements of the styling and theme as additional arguments using -`theme`, or by using `theme_override` with your new theme elements in a `list`. +As the plots are based on `{ggplot2}` you can override elements of the styling and theme as additional arguments using `theme`, or by using `theme_override` with your new theme elements in a `list`. ```{r facetvignette3} + facet_set <- ae_attendances %>% filter( org_code %in% c("RRK", "RJC", "RJ7", "R1K", "R1H", "RQM"), @@ -188,15 +196,18 @@ a <- ptd_spc( ) a + theme(axis.text.x = element_text(size = 6, angle = 45)) + ``` ### Interactive plots -It's also possible to create interactive plots using the `{plotly}` package by replacing the call to `plot` with -`ptd_create_plotly`. This takes the same arguments as `plot` (and `ptd_create_ggplot`). For instance, we can use the -code from the last example to make an interactive version +It's also possible to create interactive plots using the `{plotly}` package by replacing the call to `plot` with `ptd_create_plotly`. +This takes the same arguments as `plot` (and `ptd_create_ggplot`). + +For instance, we can use the code from the last example to make an interactive version: ```{r plotly} + ptd_spc( facet_set, value_field = breaches, @@ -211,13 +222,16 @@ ptd_spc( y_axis_label = "Number of 4-hour A&E target breaches", icons_position = "none" ) + ``` ## Come and join us! -This is a collaborative project that is still early in it's life. All contributors are volunteers, and more volunteers -would be very welcome (there's even stuff that doesn't require `R` coding to help with!). Find out more at: -[github.com/nhs-r-community/NHSRplotthedots][nhsrptd_gh] +This is a collaborative project that is still early in its life. +All contributors are volunteers, and more volunteers would be very welcome (there's even stuff that doesn't require `R` coding to help with!). + +Find out more at: +[github.com/nhs-r-community/NHSRplotthedots][ptd_gh] [mdc]: https://www.england.nhs.uk/publication/making-data-count/ -[nhsrptd_gh]: https://github.com/nhs-r-community/NHSRplotthedots +[ptd_gh]: https://github.com/nhs-r-community/NHSRplotthedots diff --git a/vignettes/number-of-points-required.Rmd b/vignettes/number-of-points-required.Rmd index a1a9cf9..e99f829 100644 --- a/vignettes/number-of-points-required.Rmd +++ b/vignettes/number-of-points-required.Rmd @@ -8,10 +8,12 @@ vignette: > --- ```{r, include = FALSE} + knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) + ``` ### How many points are required for robust control limits? @@ -26,40 +28,41 @@ Even for the I chart, the experts do not reach a consensus: **The Health Care Data Guide** (p155) : -"To develop an I chart, the most recent 20 to 30 measurements should be used. More than any other chart, this minimum number of subgroups is important since each subgroup has only one data value". +> "To develop an I chart, the most recent 20 to 30 measurements should be used. More than any other chart, this minimum number of subgroups is important since each subgroup has only one data value". **Understanding Variation - The Key to Managing Chaos** (p60): -"Useful limits may be constructed with as few as five or six values" - +> "Useful limits may be constructed with as few as five or six values" **Data Sanity** (First Edition p150): Presents a table for runs analysis, starting with 10 data points (and the corresponding lower and upper limit for expected number of runs) - Let's throw in one more reference : **Practical Performance Measurement** (p258) -"We still need a minimum of five consecutive values of a measure just to get started establishing a baseline to represent the current performance level...we might even need more than five to establish that baseline....And once we have our baseline, we need at least another three measure values, and often more than eight, before we can be sure whether performance has changed or not" +"We still need a minimum of five consecutive values of a measure just to get started establishing a baseline to represent the current performance level... We might even need more than five to establish that baseline... +And once we have our baseline, we need at least another three measure values, and often more than eight, before we can be sure whether performance has changed or not." ### I have less than 12 points. What should I do? -If Wheeler say 5 or 6 are good enough, then, as long as you have 5 or 6 points, you can begin to use these charts. However the limits should be considered _useful_, rather than _robust_. +If Wheeler says 5 or 6 are good enough, then, as long as you have 5 or 6 points, you can begin to use these charts. +However the limits should be considered _useful_, rather than _robust_. -We therefore refer to these as 'trial' limits. +We therefore refer to these as 'trial' limits. ### What is meant by 'trial limits'? -Just that, due to lack of data , these are as good as they can be, for the time being. With each new data point, the limits will be revised. Once we have enough (i.e. >=12 data points) the calculations will be locked, until such time as a signal of special cause variation occurs - for example, a long run above or below the mean. -At this point, if we understand the cause of the variation, we might decide to revise the limits from the start of the long run. Each time the limits are revised, the new limits should be considered 'trial limits' until a further 12 (or more) points are collected, at which point they can be 'locked' once more. - +Just that, due to lack of data, these are as good as they can be, for the time being. +With each new data point, the limits will be revised. +Once we have enough (i.e. >=12 data points) the calculations will be locked, until such time as a signal of special cause variation occurs - for example, a long run above or below the mean. +At this point, if we understand the cause of the variation, we might decide to revise the limits from the start of the long run. +Each time the limits are revised, the new limits should be considered 'trial limits' until a further 12 (or more) points are collected, at which point they can be 'locked' once more. ### What does this tool require? -The tool defaults to calculating control limits over the first 12 points for each area or group. - +The tool defaults to calculating control limits over the first 12 points for each area or group. ### Are there any other charts we can use if we have less than 12 points? @@ -68,7 +71,5 @@ There are alternatives: - run charts - cumulative sum (cusum) charts -However, the individuals chart is _also_ advised as one of the three "go to" charts when less than 12 data points are available. This package provides a warning for any groups with less than 12 data points, advising that trial limits are in place. - - - +However, the individuals chart is _also_ advised as one of the three "go to" charts when less than 12 data points are available. +This package provides a warning for any groups with less than 12 data points, advising that trial limits are in place. From 3f2a0f15f4ba06e8b2158069c2a64c7d62ec201f Mon Sep 17 00:00:00 2001 From: Fran Barton Date: Tue, 6 Aug 2024 00:51:16 +0100 Subject: [PATCH 3/9] Update DESCRIPTION --- DESCRIPTION | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d63121f..c4658bb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,18 +11,21 @@ Authors@R: c( person("Chris", "Mainey", ,"c.mainey@nhs.net", "aut", comment = c(ORCID ="0000-0002-3018-6171")), person("John", "MacKintosh", ,"john.mackintosh3@nhs.scot", "aut"), person("Marcos", "Fabietti", ,"marcos.fabietti@nuh.nhs.uk", "aut"), + person("Fran", "Barton", + email = "francis.barton@nhs.net", + role = "aut", + comment = c(ORCID = "0000-0002-5650-1176") + ), person("NHS-R community", email = "nhs.rcommunity@nhs.net", role = "cph") ) Maintainer: Christopher Reading -Description: Provides tools for drawing Statistical Process Control (SPC) charts. This package supports the NHSE/I - programme 'Making Data Count', and allows users to draw XmR charts, use change points and apply rules with summary - indicators for when rules are breached. +Description: Provides tools for drawing Statistical Process Control (SPC) charts. This package supports the NHSE/I programme 'Making Data Count', and allows users to draw XmR charts, use change points and apply rules with summary indicators for when rules are breached. URL: https://nhs-r-community.github.io/NHSRplotthedots, https://github.com/nhs-r-community/NHSRplotthedots BugReports: https://nhs-r-community.github.io/NHSRplotthedots/issues License: MIT + file LICENSE Encoding: UTF-8 -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.2 Roxygen: list(markdown = TRUE) Imports: assertthat, From 26b6cd079a0b8b0e24326b1f60d975b3d82f8309 Mon Sep 17 00:00:00 2001 From: Fran Barton Date: Tue, 6 Aug 2024 00:51:57 +0100 Subject: [PATCH 4/9] Add "label limits" example to README --- README.Rmd | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.Rmd b/README.Rmd index 22d9249..649c54d 100644 --- a/README.Rmd +++ b/README.Rmd @@ -117,6 +117,34 @@ sub_set %>% ) ``` + +### Adding annotations for mean and process limits + +The package (from v0.2.0) supports annotating the values of the mean and the + upper and lower process limits on a secondary (right-hand side) y axis, + if this is helpful for you and your audience. + +The way to achieve this is to turn on the `label_limits` option: + +```{r} + +sub_set |> + ptd_spc( + value_field = breaches, + date_field = period, + improvement_direction = "decrease" + ) |> + ptd_create_ggplot( + y_axis_label = "4-hour wait breaches", + main_title = "SPC of A&E waiting time breaches for RQM", + label_limits = TRUE + ) + +``` + +If you have rebased the chart, the mean and annotations will only show for the most recent section. + + ## Getting help To find out more about the `ptd_spc()` function, you can view the help with: From 4e76b7129f4de98762237d91e56f9d6eb0008078 Mon Sep 17 00:00:00 2001 From: Fran Barton Date: Tue, 6 Aug 2024 00:52:28 +0100 Subject: [PATCH 5/9] Various edits to README --- README.Rmd | 88 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 34 deletions(-) diff --git a/README.Rmd b/README.Rmd index 649c54d..8d1e97c 100644 --- a/README.Rmd +++ b/README.Rmd @@ -33,7 +33,7 @@ Please be aware that this package is in the early stages of development, and fea ## Installation -```{r, eval=FALSE} +```r # install from CRAN install.packages("NHSRplotthedots") @@ -44,33 +44,38 @@ remotes::install_github("https://github.com/nhs-r-community/NHSRplotthedots", bu # Overview -Welcome to the NHS-R community's package for building a specific type of statistical process control (SPC) chart, the -XmR chart. We are aiming to support NHS England's ['Making Data Count'][mdc] programme. The programme encourages boards, -managers, and analyst teams to present data in ways that show change over time and drive better understanding of -indicators than 'RAG' (red, amber, green) rated board reports often present. +Welcome to the NHS-R community's package for building a specific type of statistical process control (SPC) chart, the XmR chart. + We are aiming to support NHS England's ['Making Data Count'][mdc] programme. + The programme encourages boards, managers, and analyst teams to present data in ways that show change over time and drive better understanding of indicators than 'RAG' (red, amber, green) rated board reports often present. -The help files and vignettes within this package tell you more about the possible options for controlling the charts, -but below is a simple example of the type of chart the package produces. We will use the `ae_attendances` dataset from -the `{NHSRdatasets}` package and a bit of `{dplyr}` code to select some organisations. +The help files and vignettes within this package tell you more about the possible options for controlling the charts, but below are some simple examples of the type of chart the package produces. + We will use the `ae_attendances` dataset from the `{NHSRdatasets}` package and a bit of `{dplyr}` code to select some organisations. ```{r example, message=FALSE, warning=FALSE} library(NHSRplotthedots) library(NHSRdatasets) -library(tidyverse) +library(dplyr) sub_set <- ae_attendances %>% filter(org_code == "RQM", type == 1, period < as.Date("2018-04-01")) sub_set %>% - ptd_spc(value_field = breaches, date_field = period, improvement_direction = "decrease") + ptd_spc( + value_field = breaches, + date_field = period, + improvement_direction = "decrease" + ) ``` -This plot is ok on its own, but we can specify more control options when we pass it on, using the `{dplyr}` pipe -function below: `%>%` to the plot argument. +This plot is ok on its own, but we can specify more control options if we explicitly pass it on to the `plot()` function. ```{r} sub_set %>% - ptd_spc(value_field = breaches, date_field = period, improvement_direction = "decrease") %>% + ptd_spc( + value_field = breaches, + date_field = period, + improvement_direction = "decrease" + ) %>% plot( y_axis_label = "4-hour wait breaches", main_title = "SPC of A&E waiting time breaches for RQM" @@ -79,25 +84,35 @@ sub_set %>% or, equivalently: -```{r, eval=FALSE} +```r sub_set %>% - ptd_spc(value_field = breaches, date_field = period, improvement_direction = "decrease") %>% + ptd_spc( + value_field = breaches, + date_field = period, + improvement_direction = "decrease" + ) %>% ptd_create_ggplot( y_axis_label = "4-hour wait breaches", main_title = "SPC of A&E waiting time breaches for RQM" ) ``` -In addition, you can use summary() function to get some basic statistics about your SPC data frame. +You can also use the `summary()` function to get some basic statistics about your SPC data frame. The function prints the SPC options, and then returns the summarised results as a table: -```{r, eval=TRUE} + +```r summary <- sub_set %>% - ptd_spc(value_field = breaches, date_field = period, improvement_direction = "decrease", target = 1200) %>% + ptd_spc( + value_field = breaches, + date_field = period, + improvement_direction = "decrease", + target = 1200 + ) %>% summary() ``` You could assign this summary table to a variable and use it later: -```{r, eval=TRUE} +```r summary$variation_type summary$assurance_type ``` @@ -105,12 +120,16 @@ summary$assurance_type ### Interactive plots with Plotly -It's also possible to generate interactive plots using the `{plotly}` package by replacing the call to `plot` with -`ptd_create_plotly`. This function takes the same arguments as `plot`/`ptd_create_ggplot`. +It's also possible to generate interactive plots using the `{plotly}` package by replacing the call to `plot` with `ptd_create_plotly`. + This function takes the same arguments as `plot`/`ptd_create_ggplot`. -```{r, eval=FALSE} +```r sub_set %>% - ptd_spc(value_field = breaches, date_field = period, improvement_direction = "decrease") %>% + ptd_spc( + value_field = breaches, + date_field = period, + improvement_direction = "decrease" + ) %>% ptd_create_plotly( y_axis_label = "4-hour wait breaches", main_title = "SPC of A&E waiting time breaches for RQM" @@ -149,19 +168,19 @@ If you have rebased the chart, the mean and annotations will only show for the m To find out more about the `ptd_spc()` function, you can view the help with: -```{r, eval=FALSE} +```r ?ptd_spc ``` Details on the extra plot controls can be found using: -```{r, eval=FALSE} +```r ?ptd_create_ggplot ``` To view the vignette (worked example), use: -```{r eval=FALSE} +```r vignette("intro", package = "NHSRplotthedots") vignette(package = "NHSRplotthedots") @@ -169,17 +188,18 @@ vignette(package = "NHSRplotthedots") # Contribution -This is an NHS-R Community project that is open for anyone to contribute to in any way that they are able. The project -is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By -contributing to this project, you agree to abide by its terms. +This is an NHS-R Community project that is open for anyone to contribute to in any way that they are able. + The project is released with a [Contributor Code of Conduct][coc]. + By contributing to this project, you agree to abide by its terms. -If you want to learn more about this project, please join the discussion at [the NHS-R Community Slack group][nhsr-slack] -and the specific channel [#proj-nhsr-plot-the-dots][#proj-nhsr-plot-the-dots]. +If you want to learn more about this project, please join the discussion at + [the NHS-R Community Slack group][nhsr-slack] and the specific channel + [#proj-nhsr-plot-the-dots][ptd-slack-channel]. -The simplest way to contribute is to raise an issue detailing the feature or functionality you would like to see added, -or any unexpected behaviour or bugs you have experienced. +The simplest way to contribute is to raise an issue detailing the feature or functionality you would like to see added, or any unexpected behaviour or bugs you have experienced. [nhsr]: https://nhsrcommunity.com [mdc]: https://www.england.nhs.uk/publication/making-data-count/ +[coc]: https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html [nhsr-slack]: https://nhsrcommunity.slack.com/ -[#proj-nhsr-plot-the-dots]: https://nhsrcommunity.slack.com/archives/CSVD4SYF3 +[ptd-slack-channel]: https://nhsrcommunity.slack.com/archives/CSVD4SYF3 From 7c10f17043a937e03ec8755c66bc2ba1bd231332 Mon Sep 17 00:00:00 2001 From: Fran Barton Date: Tue, 6 Aug 2024 00:53:12 +0100 Subject: [PATCH 6/9] Add Fran Barton to package contributors --- man/NHSRplotthedots-package.Rd | 1 + 1 file changed, 1 insertion(+) diff --git a/man/NHSRplotthedots-package.Rd b/man/NHSRplotthedots-package.Rd index bc186e5..63bfe59 100644 --- a/man/NHSRplotthedots-package.Rd +++ b/man/NHSRplotthedots-package.Rd @@ -29,6 +29,7 @@ Authors: \item Chris Mainey \email{c.mainey@nhs.net} (\href{https://orcid.org/0000-0002-3018-6171}{ORCID}) \item John MacKintosh \email{john.mackintosh3@nhs.scot} \item Marcos Fabietti \email{marcos.fabietti@nuh.nhs.uk} + \item Fran Barton \email{francis.barton@nhs.net} (\href{https://orcid.org/0000-0002-5650-1176}{ORCID}) } Other contributors: From fae379a67883d5c8073aab5d81821786eb8fdd83 Mon Sep 17 00:00:00 2001 From: Fran Barton Date: Tue, 6 Aug 2024 01:13:00 +0100 Subject: [PATCH 7/9] Re-remove superfluous lines from R chunks in Rmd files --- README.Rmd | 2 -- vignettes/deviations.Rmd | 17 ----------------- vignettes/intro.Rmd | 14 -------------- vignettes/number-of-points-required.Rmd | 2 -- 4 files changed, 35 deletions(-) diff --git a/README.Rmd b/README.Rmd index 8d1e97c..087dabc 100644 --- a/README.Rmd +++ b/README.Rmd @@ -146,7 +146,6 @@ The package (from v0.2.0) supports annotating the values of the mean and the The way to achieve this is to turn on the `label_limits` option: ```{r} - sub_set |> ptd_spc( value_field = breaches, @@ -158,7 +157,6 @@ sub_set |> main_title = "SPC of A&E waiting time breaches for RQM", label_limits = TRUE ) - ``` If you have rebased the chart, the mean and annotations will only show for the most recent section. diff --git a/vignettes/deviations.Rmd b/vignettes/deviations.Rmd index e1cda53..2986ec2 100644 --- a/vignettes/deviations.Rmd +++ b/vignettes/deviations.Rmd @@ -8,7 +8,6 @@ vignette: > --- ```{r setup, include = FALSE} - knitr::opts_chunk$set( fig.width = 7, fig.height = 5, collapse = TRUE, @@ -18,7 +17,6 @@ library(dplyr) library(ggplot2) library(NHSRplotthedots) library(NHSRdatasets) - ``` The overall intent of this package is to mimic as completely as possible the output available from the [NHSEI Making Data Count][mdc] Excel tools. @@ -56,7 +54,6 @@ The two charts below demonstrate the default, and how to over-ride to replicate #### R Package Default: ```{r} - data <- c(1, 2, 1, 2, 10, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1) date <- seq(as.Date("2021-03-22"), by = 1, length.out = 18) df <- tibble::tibble(data, date) @@ -72,13 +69,11 @@ spc_data %>% ", LPL = ", round(spc_data$lpl[1], 2) ) ) - ``` #### Over-riding to replicate "Making Data Count" Excel output: ```{r} - # setting screen_outliers = FALSE produces the same output as Excel spc_data <- ptd_spc(df, value_field = data, date_field = date, screen_outliers = FALSE) spc_data %>% @@ -90,7 +85,6 @@ spc_data %>% ", LPL = ", round(spc_data$lpl[1], 2) ) ) - ``` @@ -113,38 +107,30 @@ Examples of these 4 are shown below: #### R Package Default: ```{r} - spc_data <- ae_attendances %>% group_by(period) %>% summarise(across(attendances, sum)) %>% ptd_spc(attendances, period, rebase = as.Date(c("2017-04-01", "2018-04-01"))) plot(spc_data, break_lines = "both") - ``` #### Just breaking the limit lines: ```{r} - plot(spc_data, break_lines = "limits") - ``` #### Just breaking the process lines: ```{r} - plot(spc_data, break_lines = "process") - ``` #### Over-riding to replicate "Making Data Count" Excel output: ```{r} - plot(spc_data, break_lines = "none") - ``` ### 3. X Axis Text Angle @@ -160,16 +146,13 @@ Any of the modifications documented in the #### To re-instate 90 degree axis text: ```{r} - ae_attendances %>% group_by(period) %>% summarise(across(attendances, sum)) %>% ptd_spc(attendances, period) %>% plot(theme_override = theme(axis.text.x = element_text(angle = 90))) - ``` - --- Find the package code on [GitHub][ptd_gh]. diff --git a/vignettes/intro.Rmd b/vignettes/intro.Rmd index 0766d5d..dbf552c 100644 --- a/vignettes/intro.Rmd +++ b/vignettes/intro.Rmd @@ -31,7 +31,6 @@ Firstly, let's load the data, filter for University Hospital Birmingham NHS Foun Let's also do a simple timeseries plot to see why this is the case. ```{r dataset, message=FALSE, warning=FALSE} - library(NHSRplotthedots) library(NHSRdatasets) library(dplyr) @@ -49,7 +48,6 @@ ae_attendances %>% scale_x_date("Date") + labs(title = "Example plot of A&E breaches for organsiation: 'RRK'") + theme_minimal() - ``` This minimal plot shows the changes over time, and we will look at it in two ways. @@ -64,7 +62,6 @@ In addition, to ensure the points are coloured correctly, we need to set the `im ## Stable period ```{r stableperiod} - stable_set <- ae_attendances %>% filter( org_code == "RRK", @@ -78,7 +75,6 @@ ptd_spc( date_field = period, improvement_direction = "decrease" ) - ``` From the chart above, we can see the centre line (mean) and the control limits calculated according the the XmR chart rules. @@ -93,7 +89,6 @@ We understand the reason for the change (the merging of two trusts), and believe To rebase (change the modelling period for control limits), we can pass a vector of dates at the point we wish to rebase using the `ptd_rebase()` function. ```{r changepoint} - change_set <- ae_attendances %>% filter(org_code == "RRK", type == 1) @@ -103,7 +98,6 @@ ptd_spc(change_set, improvement_direction = "decrease", rebase = ptd_rebase(as.Date("2018-07-01")) ) - ``` You can see that our limit calculation has now shifted at the rebase point. @@ -123,7 +117,6 @@ To find out the available options, see the help-file for: `?ptd_create_ggplot`. We will let the x-axis scale change for each plot for each plot (otherwise some would look crushed against a larger trusts) and we will also change the x-axis breaks to 3-months, as 1 month looked too busy.) ```{r facetvignette} - facet_set <- ae_attendances %>% filter( org_code %in% c("RRK", "RJC", "RJ7", "R1K", "R1H", "RQM"), @@ -139,14 +132,12 @@ ptd_spc( improvement_direction = "decrease" ) %>% plot(fixed_y_axis_multiple = FALSE, x_axis_breaks = "3 months") - ``` From this, the point-size seems too big, and it would be worth replacing the y-axis title with something better. Again, this is done with the `plot` function arguments: ```{r facetvignette2} - facet_set <- ae_attendances %>% filter( org_code %in% c("RRK", "RJC", "RJ7", "R1K", "R1H", "RQM"), @@ -167,13 +158,11 @@ ptd_spc( point_size = 2, y_axis_label = "Number of 4-hour A&E target breaches" ) - ``` As the plots are based on `{ggplot2}` you can override elements of the styling and theme as additional arguments using `theme`, or by using `theme_override` with your new theme elements in a `list`. ```{r facetvignette3} - facet_set <- ae_attendances %>% filter( org_code %in% c("RRK", "RJC", "RJ7", "R1K", "R1H", "RQM"), @@ -196,7 +185,6 @@ a <- ptd_spc( ) a + theme(axis.text.x = element_text(size = 6, angle = 45)) - ``` ### Interactive plots @@ -207,7 +195,6 @@ This takes the same arguments as `plot` (and `ptd_create_ggplot`). For instance, we can use the code from the last example to make an interactive version: ```{r plotly} - ptd_spc( facet_set, value_field = breaches, @@ -222,7 +209,6 @@ ptd_spc( y_axis_label = "Number of 4-hour A&E target breaches", icons_position = "none" ) - ``` ## Come and join us! diff --git a/vignettes/number-of-points-required.Rmd b/vignettes/number-of-points-required.Rmd index e99f829..3be70b2 100644 --- a/vignettes/number-of-points-required.Rmd +++ b/vignettes/number-of-points-required.Rmd @@ -8,12 +8,10 @@ vignette: > --- ```{r, include = FALSE} - knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) - ``` ### How many points are required for robust control limits? From b64010865aca4c692657b1947d9de5514d3a3a2e Mon Sep 17 00:00:00 2001 From: Fran Barton Date: Tue, 6 Aug 2024 02:01:30 +0100 Subject: [PATCH 8/9] Tweak DESCRIPTION formatting --- DESCRIPTION | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index c4658bb..80d8675 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,7 +16,10 @@ Authors@R: c( role = "aut", comment = c(ORCID = "0000-0002-5650-1176") ), - person("NHS-R community", email = "nhs.rcommunity@nhs.net", role = "cph") + person("NHS-R community", + email = "nhs.rcommunity@nhs.net", + role = "cph" + ) ) Maintainer: Christopher Reading Description: Provides tools for drawing Statistical Process Control (SPC) charts. This package supports the NHSE/I programme 'Making Data Count', and allows users to draw XmR charts, use change points and apply rules with summary indicators for when rules are breached. From 10d5dc0683f62fd94e8ea8d3aa7f14520bbf26cd Mon Sep 17 00:00:00 2001 From: Fran Barton Date: Tue, 6 Aug 2024 02:54:01 +0100 Subject: [PATCH 9/9] Update README.Rmd --- README.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.Rmd b/README.Rmd index 087dabc..ffb1a17 100644 --- a/README.Rmd +++ b/README.Rmd @@ -159,7 +159,7 @@ sub_set |> ) ``` -If you have rebased the chart, the mean and annotations will only show for the most recent section. +If you have rebased the chart, the mean and process limit annotations will only show for the most recent section. ## Getting help