Data Visualization with R
Last updated: June 24, 2019
Prerequisites and Preparations
To get the most out of this workshop you should have:
- a basic knowledge of R and/or be familiar with the topics covered in the Introduction to R.
- have a recent version of R and RStudio installed.
- have installed the
tidyverse
package.
Recommended:
- Create a new RStudio project
R-data-viz
in a new folderR-data-viz
and download both CSV files into a subdirectory calleddata
:- Download
MS_stops.csv
from here: https://github.com/cengel/R-data-viz/raw/master/data/MS_stops.csv - Download
MS_county_stops.csv
from here: https://github.com/cengel/R-data-viz/raw/master/data/MS_county_stops.csv - If you have your working directory set to
R-data-viz
which contains a folder calleddata
you can copy, paste, and run the following lines in R:
- Download
download.file("https://github.com/cengel/R-data-viz/raw/master/data/MS_stops.csv",
"data/MS_stops.csv")
download.file("https://github.com/cengel/R-data-viz/raw/master/data/MS_stops_by_county.csv",
"data/MS_stops_by_county.csv")
- Open up a new R Script file
R-data-viz.R
for the code you’ll create during the workshop.
References
Chang, W. (2012): R Graphics Cookbook. Stanford only online access
Healy, K (2019): Data visualization : a practical introduction. Searchworks
Murrell, P. (2012): R Graphics, 2nd ed. Stanford only online access
Rahlf, T (2017): Data Visualisation with R. http://www.springer.com/us/book/9783319497501
Wickham, H. (2016): ggplot2: Elegant Graphics for Data Analysis. 2nd ed. http://link.springer.com/book/10.1007/978-3-319-24277-4
Acknowledgements
Part of the materials for this tutorial are adapted from http://datacarpentry.org and http://softwarecarpentry.org.
Data sample taken from https://openpolicing.stanford.edu/