Promoting the use of R in the NHS

NHS-R Solutions

NHS-R Solutions co-funded by NHSx

As part of NHS-R Community’s aim to support the learning, application and exploitation of R in the NHS, NHS-R together with NHSx provides funding to ‘Solutions’.

Solutions are R packages or training that have been proposed or identified, that will help the NHS to take advantage of the huge benefits of R.

We aim to provide funding ( typically <10K per project) for data science related technical solution using open source platform such as R, Python (+ other open-source tools) in health and social care.

Current Solutions

EndomineR is itself a highly useful piece of software for clinical use, the Shiny interface being developed would allow non coders to use it. Rolling out code based clinical solutions based on R to non technical audiences using tools like Shiny is a useful way for NHS-R to add value to the NHS.

The phsmethods package has been developed to assist analysts in Public Health Scotland (PHS) with common analytical tasks. The benefits of this package are reducing duplication of effort where the same functions need to be written across multiple analyses and projects, reducing the likelihood of error, and a general streamlining of code and outputs in the organisation. This Solution will:

  • deepen the current function’s approaches and incorporate data requirements from other nation’s NHS systems
  • scope of the functions within the package could be widened
  • submit the package to CRAN

Building on the success of the introduction to R training and the recoding of the slides to be more accessible and updatable, this solution will add more interactive features to the training using the {learnR} package.

The package will be used specifically to add:

  1. Code exercises (R code chunks that users can edit and execute directly).
  2. Quiz questions.

The MSDS Pipeline takes responsibility for joining and cleaning using repeatable R code, making the cleaned data set available for anyone to work on without needing to duplicate the same work. 

In addition to the joining and cleaning, the package will:

  • Report any inconsistencies in the data set
  • Produce simple “canned reports” comparing a given trust to national averages.  Intended as a demonstrator only, as will not include adjustments for regional demographic / deprivation differences.  
  • Produce a data quality summary for use internally in a given trust, to understand and troubleshoot missing data and data quality issues. 

Completed Solutions

The NHS Data Dictionary is a package that does web scraping of a number of key NHS data dictionary lookups to have all the reference codes in one place.
NHSDataDictionaRy is  now available on CRAN:

Introduction to Shiny courses for NHS and UK Public Sector including a Train the Trainer workshop.

View the Training on NHS-R Community YouTube:
Shiny Training Session 1
Shiny Training Session 2

FunnelPlotR will be a package with a standard interface, taking a data.frame input with a grouping variable, a numerator and a denominator, with various controls for the control limits, outlier detection and colour schemes making this process easier.   

Funnel plots have various methods depending on the data type, and the process for statistical adjustments are complicated to the lay-user. 

There are thousands of patient feedback records that require labelling. Although some trusts read and code all their feedback, many do not. Consequently, areas where urgent action for making improvements is necessary may be missed or delayed. Trusts would benefit from an automated labelling process that would help them speed up the process of labelling and, consequently, the response speed to any issues the patients have raised. 

Nottinghamshire Healthcare NHS Foundation Trust has built a Text Classification model that is designed to predict the labels of unlabelled patient feedback. In order to make the Text Classification model available to the R community, as well as to better integrate the working of the models with the dashboard, this Solution will wrap the Python functions in R and release as a CRAN package.  

The purpose of this Solution is to develop a complete Rmarkdown workshop that would teach R users how to organise their code/visualisations into a fully functional reporting suite.

This workshop will teach the following principles:

  1. Introduce the differences between Rmarkdown and R scripts. (further depth than intro to R)
  2. Introduce Rmarkdown YAML and other design functionality (i.e. inline/outline coding)
  3. Showcase dynamic visualizations and dataframes {plotly} {crosstalk} {DT}
  4. Teach the pros/cons of procedural and functional programming (when to use them)
  5. Automation of Rmd through functional programming {rmarkdown} {knitr} {RODBC}
  6. Showcase subspecialties of Rmd (i.e. powerpoint, parameterisation)
  7. Group case study practice

This package is built by the NHS-R community to provide 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.

Draw XmR Charts for NHSE/I Making Data Count Programme • NHSRplotthedots (


If you or your team are developing a package in R or a have a Solution you think NHS-R should consider please complete the proforma and send this to

If you have any questions about NHS-R Solutions or would like advice on submitting a proposal, please contact:

All NHS-R solutions are required to be released under an open source licence.
Please see this Blog for further information about Software licensing

All applications are considered by the NHS-R Technical Advisory Group and requestee will be informed as soon as an approval decision has been made.

If your proposal is accepted, you will be expected to participate in dissemination activities during your work on creating your NHS-R/X Solution:

  • Write a blog about your Solution
  • Register on Hexitime and give some time to supporting the dissemination of your Solution
  • Present at an NHS-R event: Conference, Webinar or Workshop
  • Join the NHS-R Slack Channel or relevant NHS Futures workspace, to answer questions about the final product
  • Maintain & develop your solutions with (where appropriate) input from others.