Site icon R-bloggers

Teaching and Learning Materials for Data Visualization

[This article was first published on R on kieranhealy.org, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Data Visualization: A Practical Introduction will begin shipping next week. I’ve written an R package that contains datasets, functions, and a course packet to go along with the book. The socviz package contains about twenty five datasets and a number of utility and convenience functions. The datasets range in size from things with just a few rows (used for purely illustrative purproses) to datasets with over 120,000 observations, for practicing with and exploring.

A course packet is also included the package. This is a zipped file containing an R Studio project consisting of nine R Markdown documents that parallel the chapters in the book. They contain the code for almost all the figures in the book (and a few more besides). There are also some additional support files, to help demonstrate things like reading in your own data locally in R.

Installing the package

To install the package, you can follow the instructions in the Preface to the book. Alternatively, first download and install R for MacOS, Windows or Linux, as appropriate. Then download and install RStudio. Launch RStudio and then type the following code at the Console prompt (>), hitting return at the end of each line:


my_packages <- c("tidyverse", "fs", "devtools")
install.packages(my_packages)


devtools::install_github("kjhealy/socviz")

Once everything has downloaded and been installed (which may take a little while), load the socviz package:

library(socviz)

The Course Packet

The supporting materials are contained in a compressed .zip file. To extract them to your Desktop, make sure the socviz package is loaded as described above. Then do this:


setup_course_notes()

This will copy the dataviz_course_notes.zip file to your Desktop, and uncompress it into a folder called dataviz_course_notes. Double-click the file named dataviz.Rproj to launch the project as a new RStudio session. If you want to uncompress the file somewhere other than your Desktop, e.g. your Documents folder, you can do this:


setup_course_notes(folder = "~/Documents")

The source code for socviz is available on GitHub. I plan on continuing to update and improve it as I use it myself in my own classes and workshops.

To leave a comment for the author, please follow the link and comment on their blog: R on kieranhealy.org.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.