{"id":14068782,"url":"https://github.com/johnmackintosh/runcharter","last_synced_at":"2025-07-10T17:32:27.313Z","repository":{"id":53968970,"uuid":"173734311","full_name":"johnmackintosh/runcharter","owner":"johnmackintosh","description":"Automating run chart analysis for faceted displays of data across multiple metrics or locations","archived":false,"fork":false,"pushed_at":"2022-09-08T23:35:01.000Z","size":12154,"stargazers_count":38,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-02T09:16:02.610Z","etag":null,"topics":["chart-analysis","healthcare","nhs","nhs-r-community","quality-control","quality-improvement","quality-improvement-efforts","r","rdatatable","rstats","rstats-package"],"latest_commit_sha":null,"homepage":"https://johnmackintosh.github.io/runcharter/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnmackintosh.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-04T11:43:29.000Z","updated_at":"2024-09-26T02:45:32.000Z","dependencies_parsed_at":"2022-08-13T05:20:54.884Z","dependency_job_id":null,"html_url":"https://github.com/johnmackintosh/runcharter","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/johnmackintosh/runcharter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnmackintosh%2Fruncharter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnmackintosh%2Fruncharter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnmackintosh%2Fruncharter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnmackintosh%2Fruncharter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnmackintosh","download_url":"https://codeload.github.com/johnmackintosh/runcharter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnmackintosh%2Fruncharter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264400617,"owners_count":23602291,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chart-analysis","healthcare","nhs","nhs-r-community","quality-control","quality-improvement","quality-improvement-efforts","r","rdatatable","rstats","rstats-package"],"created_at":"2024-08-13T07:06:24.164Z","updated_at":"2025-07-10T17:32:27.281Z","avatar_url":"https://github.com/johnmackintosh.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"\n---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\"\n)\n```\n\n# runcharter \u003cimg src=\"man/figures/logo.png\" width=\"160px\" align=\"right\" /\u003e \n\n\nAutomated analysis and re-basing of  run charts at scale.\n\nOnline documentation and vignettes : [https://johnmackintosh.github.io/runcharter/](https://johnmackintosh.github.io/runcharter/)\n\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/johnmackintosh/runcharter/workflows/R-CMD-check/badge.svg)](https://github.com/johnmackintosh/runcharter/actions)\n\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n[![Coverage status](https://codecov.io/gh/johnmackintosh/runcharter/branch/master/graph/badge.svg)](https://codecov.io/github/johnmackintosh/runcharter?branch=master)\n[![Render README](https://github.com/johnmackintosh/runcharter/actions/workflows/render-readme.yaml/badge.svg)](https://github.com/johnmackintosh/runcharter/actions/workflows/render-readme.yaml)\n[![Codecov test coverage](https://codecov.io/gh/johnmackintosh/runcharter/branch/master/graph/badge.svg)](https://app.codecov.io/gh/johnmackintosh/runcharter?branch=master)\n[![CRAN status](https://www.r-pkg.org/badges/version/runcharter)](https://CRAN.R-project.org/package=runcharter)\n\n[![CRAN\nDownloads](https://cranlogs.r-pkg.org/badges/runcharter)](https://cran.r-project.org/package=runcharter)\n\n[![Total\nDownloads](https://cranlogs.r-pkg.org/badges/grand-total/runcharter)](https://cran.r-project.org/package=runcharter)\n\n\u003c!-- badges: end --\u003e\n\n\n## Installation\n\nYou can install the latest stable version from CRAN with:\n\n```{r,cran-install, eval = FALSE}\ninstall.packages(\"runcharter\")\n```\n\nYou can install the development version from github with:\n\n```{r gh-installation, eval = FALSE}\n# install.packages(\"remotes\") # if not already installed\nremotes::install_github(\"johnmackintosh/runcharter\")\n\n# to ensure the vignettes are built or ensure latest version is installed:\n\nremotes::install_github(\"johnmackintosh/runcharter\", \n                         build_vignettes = TRUE)\n```\n\nThe rationale for the package is to analyse multiple run charts at once.\nMore importantly, the package will identify a run of n successive points on the desired side of the median line, and will recalculate / rebase the median accordingly.\nEach time a run occurs, the median will be rebased.\nThis helps to track improvements over time. \n\n\nThe default is to plot a faceted plot, allowing ggplot2 to handle the axis limits. \nYou can specify the number of columns in the faceted plot however, and you can also specify both the breaks for date labels on the x axis, and whether the y axis limits are fixed, or can vary by facet panel.\n\n\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.width = 8,\n  fig.height = 5\n)\n```\n\n\n# Function arguments and defaults\n\nA default run of 9 is specified as that is the length of run used by the IHI for its patient safety initiatives worldwide. \n\n```{r, eval=FALSE}\n\nlibrary(runcharter)\nruncharter(df = signals,\n          med_rows = 13,\n          runlength = 9,\n          direction = \"below\",\n          datecol = NULL,\n          grpvar = NULL,\n          yval = NULL,\n          facet_cols = NULL,\n          facet_scales = \"fixed\",\n          chart_title = NULL,\n          chart_subtitle = NULL,\n          chart_caption = NULL,\n          chart_breaks = NULL,\n          line_colr = \"#005EB8\", # blue\n          point_colr =\"#005EB8\", # blue\n          median_colr = \"#E87722\", # orange\n          highlight_fill = \"#DB1884\") # magenta\n\n```\n\nThe function will return a plot and a summary table showing the original baseline medians, and any sustained runs of improvement beyond the baseline period.\n\n\n```{r runs_below, fig.width = 8, fig.height= 5}\n\nlibrary(runcharter)\n\nruncharter(signals,\n           direction = \"below\",\n           datecol = date, \n           grpvar = grp,\n           yval = y, \n          chart_title = \"Runs identified\",\n          chart_subtitle = \"Runs below the median signalling improvement\")\n\n```\n\n\n\n## Runs in both directions\n\nThe package allows for finding runs in both directions (above and below the median). \nGenerally, for improvement purposes, you would only need to identify runs in one direction at a time. \nIn other words, if you are trying to reduce adverse events, improvement will be evidenced with a run below the median. Therefore, you would not rebase the median if a run of points above the median was observed. \n\nHowever, for longer term monitoring, it may be necessary to identify and 'reset' a median if a sustained deterioration in performance occurs. Ideally, you should move to using SPC charts for monitoring purposes.\n\n```{r, runs_7_5_both_directions, fig.width = 8, fig.height= 5}\nlibrary(runcharter)\nsignals %\u003e% \n  runcharter(med_rows = 7, \n             runlength = 5,\n             direction = \"both\",\n             datecol = date, \n              grpvar = grp,\n              yval = y, \n             chart_title = \"Runs in both directions\",\n             chart_subtitle = \"Runs of 5, from median calculated over first 7 data points in each location\")\n\n```\n\n\n## Design decisions and similar packages\n\nThis package makes no attempt to identify or highlight 'trends' (consecutively increasing or decreasing points) or shorter 'shifts' of runs below the median.\nIn 8 years of working with QI data, I very rarely see trends, and when they do appear, they tend to result after a period of process degradation, when the process begins to return back to its natural median state. \n\nIn addition, research by qicharts2 author Jacob Anhoej shows that the trend rule is not reliable. There are no plans to add tests to identify trends to the package.\n\nHowever, analysts are often asked to apply all the run chart rules.  \nIn this case, if you need to apply the rules for trend , and still have the ability to revise run chart medians, you should consider using [the runchart package by Joseph Adams](https://github.com/jsphdms/runchart).\n\n\n[qicharts2](https://github.com/anhoej/qicharts2) creates run and SPC charts. These can be rebased, but you must specify when to do so. Also, the analysis is based on the author's own rules and not the rules typically used in healthcare (e.g. the rules promoted by the IHI).\n\n\n## Turn off run chart analysis\n\nYou can avoid rebasing medians by setting 'runlength' to 0 (zero).\nThis will plot the runcharts with the original baseline medians, but no runs analysis will take place.\n\n```{r medians_only, fig.width=8, fig.height=5}\nlibrary(runcharter)\nsignals %\u003e% \n  runcharter(med_rows = 13,\n             runlength = 0, \n             datecol = date,\n              grpvar = grp, \n              yval = y,\n             direction = \"both\")\n\n```\n\nSimilarly, you can plot basic line charts by setting 'med_rows' to 0 (zero)\n\n```{r lines_only, fig.width=8, fig.height=5}\nlibrary(runcharter)\nsignals %\u003e% \n  runcharter(med_rows = 0,\n             runlength = 9, \n             datecol = date,\n              grpvar = grp, \n              yval = y,\n             direction = \"both\")\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnmackintosh%2Fruncharter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnmackintosh%2Fruncharter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnmackintosh%2Fruncharter/lists"}