The Transforming Publishing team have created a toolkit of templates, guides and resources to support the modernisation of both the back end production of statistical products (Reproducible Analytical Pipelines) and the user-facing output of statistical products to a digital platform (Transformed Publications). These tools will also be helpful when moving from a proprietary software such as SPSS or SAS, to an open source software such as R for any statistical analyses. If you have any questions about this toolkit then please contact our team at phs.transformingpublishing@phs.scot and we'd be delighted to help.
Reproducible Analytical Pipelines are a way to introduce a robust, efficient and reproducible work flow when carrying out data analysis. They have traditionally been applied to statistical publications, but the principles are relevant to any analysis.
- This paper explains what Reproducible Analytical Pipelines are, how to assess whether your work is suitable to ‘RAP’ and details several levels of code maturity and RAP which can be selected depending on a number of factors, such as the skill in your team or the available IT infrastructure.
- The PHS R Style Guide should be followed by analysts when writing any R code to improve consistency across the organisation and ensure that our R code is readable, shareable and reusable.
- Use the recommended PHS R project structure when writing R code to ensure you have a sensible workflow and structure.
- The phstemplates package can be used to create an R project within RStudio which follows the above recommended structure.
- Use these National Statistic publication templates to automate your PDF reports using Rmarkdown.
- See RMarkdown Tips for a variety of tips and guidance relating to producing RMarkdown reports. It is a live document and more tips can be added in overtime.
- See Infographics Template for creating an inforgraphic containing some aligned charts and descriptive text, by using either RMarkdown or R plotting package ggpubr.
- See Automating Excel Guidance for tips and guidance on how to automate tables and charts within Excel.
- This app contains a range of resources for R, such as links to online training and cheatsheets, and information about internal R user groups.
- The Transforming Publishing team also have a resources area, with useful resources on technical issues such as version control.
- If using git for version control, you should follow our team's GitHub guidance on workflow and security.
PHS have developed a new web-based way of releasing statistical publications to our users and has now released two publications in this format: Acute Hospital Activity and Beds and Psychiatric Inpatient Activity. This new design has been developed with users at the heart of the process, and incorporates elements of static text, D3 charts, RShiny dashboards and open data.
It is vital that users are part of the development, or re-development, of a statistical publication so that we can ensure that the final product meets their needs and is usable. This means involving users before, during and after development.
- Accessibility should be a primary consideration when developing any outputs. Regulations covering this requirement for public sector that came into force in September 2018. Accessibility Guidance has since been developed and is hosted on Spark.
- Use this blank RShiny template when starting to build a new app or dashboard to ensure you have a sensible workflow and structure.
- Follow these examples of our existing RShiny dashboards for good practice in terms of both coding and design: Psychiatric Inpatient Activity Data Explorer code and Acute Activity Data Explorer code.
- When developing data visualisations and dashboards follow the style and design guidelines in the Chart and dashboard guidance paper.