Introduction to R and R Studio

This is a second edition of the Introduction to R and R Studio material which is extended for data manipulation and broken into smaller chapters to offer greater flexibility for trainers.

The link to the published materials is in a suggested order.

Course preparation

Data for the course is held in a separate repository and details on how to get set up for the course can be found in the NHS-R Way book.

Part 1


Course agenda and aims
Introducing and getting started with RStudio
Introducing what packages are in R



Opening Quarto

Part 2

Importing data

Import a csv
Import a messy csv
Import a csv from the web

Important features of coding

{dplyr} data wrangling with a selection of main functions
{dplyr} showcase more functions



Creating new objects
Introducing vectors
Joining data together
How to style your R code

Finding Help

Finding help on functions using RStudio and the internet
Ongoing learning resources

Part 3

Introducing chart visualisations using {ggplot2}



Using {datapasta}
Using {janitor} to remove blank rows/columns and tidy column names
Using {stringr} for cleaning with strings (for example % wildcard searches)

Spotted a mistake?

Please let us know if there are mistakes or improvements by creating an issue.