December 12, 2018

· R · data · visualization · Sociology
Data Visualization cover

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.

All Categories


about

I am Professor of Sociology at Duke University. I’m affiliated with the Kenan Institute for Ethics, the Markets and Management Studies program, and the Duke Network Analysis Center. Learn more.

Where

subscribe

To be notified of updates, you can subscribe to the  RSS feed for the site.

search