This is an R package of datasets, functions, and course materials to go along with the second edition of the book Data Visualization: A Practical Introduction (Princeton University Press, 2026).
The socviz package contains about thirty datasets and a number of
utility and convenience functions. Most of them are used in _Data
Visualization: A Practical Introduction, and there
are also a few others as well for self-learners and students to practice
their skills on.
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", "sf")
install.packages(my_packages)
install.packages("socviz")To install the development version of socviz, instead of
install.packages("socviz") do the following:
remotes::install_github("kjhealy/socviz")Once everything has downloaded and been installed (which may take a
little while), load the socviz package:
library(socviz)The included datasets and functions are documented at https://kjhealy.github.io/socviz/reference/.

