Dynamic reports are data-driven documents that can be periodically updated as their underlying data changes. This resource is a brief introduction to writing dynamic reports using R, Rmarkdown, and RStudio Cloud. It runs as a series of interactive sessions, and is designed for those without previous programming experience working in health, care, and housing. It gives a general introduction to the tools, and then some useful examples of frequently-met data-driven tasks. It is intended as a starting point for automating your report writing processes, with the aim of replacing, enhancing, or simplifying, manual report writing. The demonstration also covers ways of producing the report in a variety of formats.
This training provides a brief introduction to writing dynamic reports using R, Rmarkdown, and Posit Cloud (previously known as RStudio Cloud). It runs as a series of four interactive sessions, and is designed for those without previous programming experience working in health, care, and housing across Scotland. It is intended as a starting point for automating your report writing processes, with the aim of replacing, enhancing, or simplifying, manual report writing. The training also covers ways of producing reports in a variety of formats including .pdf, .docx (Word format), and .html (webpage).
Some examples of routine reports that might be targets for re-working in a dynamic format:
Please use the booking form to register your interest in the programme.
This training is intended for someone who:
A recent personal example of a copy and paste error encountered while writing a short report. This would have been avoided with a dynamic report.
Ultimately, it’s for you to decide whether automating your report will be worth the investment of time. But to help you come to a decision, here are some of the strengths and weaknesses of dynamic reports compared to traditionally-produced static reports:
Strengths
Weaknesses
On balance dynamic reports have more advantages than disadvantages. But decisions about whether to automate a report will depend on the local factors in play. It might be useful to have a think about how dynamic report writing might fit into your work before the training session too - and discuss them with your colleagues.
We’ll use three tools to write the report. First, we’ll use the web service Posit Cloud. This allows us to run R without installing any software or making any changes to our computer. Next, we’ll use the markup language Rmarkdown to add some text and images to our report. Finally, we’ll use the R programming language to do some simple data handling, analysis, and visualisation.
Just in case you’d like to look into how these tools work in advance of the session, we would recommend:
Posit Cloud is easy to set-up and free for small-scale work like this demo. This makes it by far the easiest way to get going from scratch if you’ve never worked with R before. Note that because it’s a web service, it requires you to upload your data to their servers, which might makes it unsuitable for production work in health and care owing to information governance concerns. That said, it’s easy to transfer projects from Posit Cloud to an installed version of R, so don’t worry that what you learn here will be tied to the cloud forever.
One important tip: this is a learning resource, and you’ll need time to think about it, play around with it, and reflect on how it might inform your work. Don’t try to use this training to change your way of writing reports under pressure. There’s quite a lot to think about here, and you might need to spend a good bit of time working out how to adapt this demonstration to fit your report. Think of this as the start of a journey, rather than a destination.
As Posit Cloud is a web service, you don’t need a particularly up-to-date computer to completed this training. As long as you have a reliable internet connection, and are capable of making a video call with Microsoft Teams (for the face-to-face part of the training), then you should be fine. The demonstration has been tested on Windows 10, Windows 11, and Ubuntu Linux 21.04 without platform-specific difficulties.
It is extremely helpful, although not essential, to have a multi-monitor setup. That way you can run the demonstration in one screen, and the Teams call on the other.
You’ll need to do a little bit of preparation before the first training session, which should take about 15 minutes to complete. Please make sure you have completed this before the start of the first session so that we can make a prompt start. If you’re new to Posit Cloud, please follow the step-by-step instructions below. If you’ve worked with Posit Cloud before, you can just sign-in to your account at Posit Cloud, create a new project from the GitHub Repository at https://github.com/bclarke-nes/Introductory-R-and-Rmarkdown, and then open the demo.Rmd file from the file pane.
Step-by-step instructions
Go to https://rstudio.cloud/ to access Posit Cloud
If you have an account, you can log in as normal. Otherwise, please create a new account by selecting Get started for free, following the steps, and then signing-in
Several users have reported difficulties completing this account creation process. A quick workaround is to create the account from your phone (or other non-NHS device). You can then log-in using your new credentials from your NHS computer.
When prompted, enter the URL https://github.com/bclarke-nes/Introductory-R-and-Rmarkdown
If you’ve never used GitHub before, you can think of it as a website where programmers can store code. All we’re doing in this step is creating a copy of the training files in your Posit Cloud account. If you’d like to learn more about GitHub, we recommend this brief and non-technical introduction.
Don’t worry if this first sight of the the Posit Cloud interface is a shock. There’s an awful lot happening here, and most of the apparent complexity is just information overload! We’ll start adapting the interface to be more friendly at the start of the first interactive session.
That’s it - you’re ready for the first session.
This session will:
By the end of this session, the user should: