Training

Posit Cloud

NHS-R Community pay for an account to use workspaces and projects for training/workshops. These mean that people can have projects that are set up with all the packages they require, have access to the latest version of R and RStudio and projects can be preloaded with any scripts or data.

Warning

As Posit Cloud is hosted in the US this is used only for training where data is publicly available and the recommendation is to never use the Cloud for analysis of any sensitive data.

The Posit Cloud account is monitored and maintained by admins who have access to all projects and individual’s projects in the workspaces. Admins are:

Posit Cloud terminology

The workspace is the overall work area that is managed by a person for a training session or workshop. The projects are set up within the workspace and are set to duplicate for individual’s to also join the workspace.

Note

Administrators for workspaces can see everyone’s project and can enter them if required.

Only one person at a time can be in a project.

Deletion of Posit workspaces and projects

To ensure that the Cloud is manageable and being used appropriately, projects can be moved by their creator to their own personal workspace.

Actively used workspaces

Projects in active workspaces, like the Introduction to R and R Studio workshop, will be archived after 3 months which means the project isn’t counted in the Cloud usage but is still retrievable.

One off workspaces

Workspaces for one off events like at conferences will be archived after 3 months and deleted after 6 months.

Prework for attendees

Equipment - screens

Many of the course and workshop formats expect a “code along” approach which is best done with 2 screens for comfort of moving between the demonstration and using RStudio on your computer.

Where users use two separate computers to enable having 2 screens, this may cause issues with sharing code in the chat functions and it will not be possible to share the coding screen for debugging support. If the person is using a Posit Cloud workspace and the course leader is an administrator then the course leader can access the project to debug.

Set up Posit Cloud

Sign up for a free Posit Cloud account at https://posit.cloud/ before the workshop. Log in with either an existing Google or GitHub account, or alternatively set up an account directly with Posit Cloud.

NHS-R Community will send an email confirmation that will include the specific Posit Cloud work space invitation link.

All the files and necessary packages are pre-loaded to the Cloud work space.

When you first log in with the link shared in the email it will take you to an Posit Cloud screen that says about Joining a space. Click on the blue button for Join Space:

Screenshot of the work space view in R Studio Cloud

The next screen that loads is a welcome page to the workshop and the final screen will have a project in it that, in this example, is called Intro_R_RStudio. When this is selected the project gets copied so you will see both the original Intro_R_RStudio and your own new one called Untitled. Although the word continue appears next to the original screen you will open your copy.

Difference between NHS-R workspaces and your own

You will be restricted to a certain number of hours a month on the free account which should be enough for the purpose of a day workshop, however, the NHS-R work space doesn’t, currently, have that restriction.

Taking the scripts to your own workspace

To move the project you’ve created to your own work space (which is available with the account you set up) select the moving trolley icon:

Screenshot of the project name and to the right 4 icons, the bin for delete, moving trolley, the down arrow to download and three dots in a circle

Then select Your work space. If you’ve been invited to any other work space you will also see them in the same Move Content screen:

Screenshot of the Move Content wizard with 3 options, Your work space and two others from NHS-R

It’s possible to download your files instead by using the down arrow by the Project.

Using your own laptop/computer

Some VPNs (Virtual Private Networks) block access to Posit Cloud or you may wish to use your own computer. VPNs sometimes do work but block parts of the R functionality, this is particularly a problem with Shiny apps.

If that is the case please ensure you have the latest R and RStudio installed. Technical guidance on what programs are required and how to get those installed can be found in the NHSR Community Statement on Tools book.

It is important to have the latest R installed as older versions of R have had issues when installing {tidyverse} packages. Errors say that packages like broom or readr cannot be installed but even when this has been installed separately there continue to be other errors. Some of the answers in this post from Posit community may help.

Warning

If you require permission for programs to be installed on your computer by an IT department, it is worth getting agreement to also have these updated by your IT department regularly or by request as it is always good practice for fixing issues and bugs.

Introduction to Git and GitHub using R course programs

If you are attending the Introduction to Git and GitHub using R course you will need to have Git installed https://git-scm.com/downloads

and follow the slides published through GitHub.

Course materials

Materials produced by and for NHSR Community will be available through GitHub. However, some workshops are provided with course material available through Posit Cloud only so contact the core development team to request materials.

Introduction to R and RStudio course materials

The Introduction to R and RStudio workshop materials can be found in a specific module. Click on the green Code button

Screenshot of the GitHub download files page with the selection from the dropdown of Download zip highlighted

The zip includes the data files which will be used in the workshop.

The following code can be run from the Console in RStudio to download the same files:

install.packages("usethis")
usethis::use_course("nhs-r-community/intro_r_data")

Downloading course slides only

If you want to have the slides on your computer, they can be downloaded from the same repository as the intro-r files but on a branch called gh-pages. Using the same process as for Downloading files above you can download these to your computer by clicking on the green button and selecting the zip download.

Installing packages

Packages are installed as part of the course but the slide about packages from the course has details of the main package used and the code required to install.

Other packages mentioned in the course (but are also installed as part of the learning) are:

install.packages(c("beepr", "styler", "janitor", "stringr", "stringi"))

Introduction to Git and GitHub using R course materials

The Introduction to Git and GitHub using R workshop materials can be found on a published GitHub page.

Downloading all course material

To download all the files (including the slides) then on the main GitHub repository click on the green Code button on the repository and this will copy all the files.

Screenshot of the GitHub download files page with the selection from the dropdown of Download zip highlighted

Installing packages

The following slide published through GitHub details the packages used in the course.

GitHub account

To use GitHub you will need to:

Workshop confirmation emails

The NHS-R Community confirmation email will include:

  • the link to the workshop
  • the Posit Cloud specific workspace url and
  • a calendar invitation

If you are not sure that you can access Zoom from your work laptop, please request a test Zoom meeting coordinated by the core development team.

Modern desktop users (NHS England)

Some organisations are using a modern desktop system, please note that project do not appear to work with Projects/setwd and files like RMarkdown and Quarto don’t appear to work, giving the error:

Warning message: In options(stringsAsFactors = TRUE) : ‘options(stringsAsFactors = TRUE)’ is deprecated and will be disabled Error in setwd(“C:/R/WorkingDir”) : cannot change working directory Execution halted

Currently, the way around this is to create the missing folder “C:/R/WorkingDir” (so WorkingDir folder in a folder called R on the C: drive) and whilst the warning message will remain the report scripts .rmd and .qmd will work. The other recommendation is currently to work through UDAL if there is access.