Material for the Pearson Live Training Session for O’Reilly
"Hands–On Data Visualization with ggplot2: Concepts"
This is the first training of a two-part workshop series "Create Data Visualizations in R Using the Grammar of Graphics” in collaboration with Pearson and O'Reilly.
- Part 1: "Hands–On Data Visualization with ggplot2: Concepts" (this course)
- Part 2: "Hands-On Guide to Advanced Data Visualization with ggplot2: Custom Design" → Repo
To get a copy of all the material, clone this repository to a directory of your choice or download and unpack this zip folder.
To run any of the materials locally on your own machine, you will need to install the following:
- A recent version of R (download from here)
- A recent version of RStudio (download from here)
- A suite of R packages:
- ggplot2
- readr
- dplyr
- forcats
- stringr
- ragg
- scales
- gapminder
You can install all required R packages at once by running the following code in the R command line:
pkgs <- c("ggplot2", "dplyr", "readr","forcats", "stringr", "scales", "ragg", "gapminder")
unavailable <- setdiff(pkgs, rownames(installed.packages()))
install.packages(unavailable)
To run the code, open up Rstudio. Copy–paste the code in the console pane (by default in the lower left) and hit enter. Several messages should pop up. Scan these messages that are returned for errors and troubleshoot them if necessary. Warnings and other informational messages can be ignored.
We are using a non-default font in this session. If you want to run all code "as it is", please install the Asap Condensed typeface which is available for free. You find the files in the fonts folder
. Install them by double-clicking.
If you don't want to or can't install the fonts, it is still possible to run the code. Just make sure to replace the font families in the code with one that is installed on your system--or remove the respective rows (more information during the session).
If you want to save your visualization to PDF, please make sure that XQuartz is installed which is needed to use the cairo pdf device.
Double-click on the fundamentals-ggplot2-pearson.Rproj
file which opens up Rstudio with the working directory set to the same folder (i.e. the directory where the Rproj file is placed).
Now, you can open any script from the files pane (by default in the lower right).
To follow the training, open the script fundamentals-ggplot2-pearson.R
.