An Introduction to ggplot for NHSr
This is the course site for the Introduction to ggplot workshop created by Eugene Hickey for the NHS-R Community.
This six-hour hands-on workshop will be a gentle introduction to ggplot package as a tool to create impressive graphics and data visualisations.
This workshop is designed for people with previous experience of R but have yet to take the plunge to working with ggplot.
Hopefully most of what you need will be on this webpage. Our exercises can be done from within the slides themselves. But if you’d prefer to work on a local machine, then….
We’ll be using the software listed below.
You can find step-by-step instructions for installing these here: macOS, Windows.
# From CRAN
list_of_packages <- c("tidyverse", "ggthemes", "carData",
"scales", "showtext", "wesanderson",
"RColorBrewer", "viridis", "dslabs",
"gplots", "palmerpenguins",
"gapminder", "datasets", "HistData")
# run the following line of code to install the packages you currently do not have
new_pkgs <- list_of_pkgs[!(list_of_pkgs %in% installed.packages()[,"Package"])]
if(length(new_pkgs)) install.packages(new_pkgs)
# From GitHub
devtools::install_github("nhs-r-community/NHSRdatasets")
This workshop draws from various sources, most notably the books by Kieran Healy and Claus Wilkie. I’d also like to mention the webpage of The Top 50 ggplot2 Visualisations. This workshop ran smoothly with the help of Sharon Townsend as co-pilot.
This website was made with the distill package. The content was created using xaringan by Yihui Xie, flair by Kelly Bodwin, learnr and xaringanExtra (both by Garrick Aden-Buie), and flipbookr by Gina Reynolds. And special thanks for a custom theme designed by Silvia Canelón.
If you see mistakes or want to suggest changes, please create an issue on the source repository.
Text and figures are licensed under Creative Commons Attribution CC BY-SA 4.0. Source code is available at https://github.com/eugene100hickey, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".