
This is an R package of datasets and utility functions to accompany Data Visualization: A Practical Introduction (Princeton University Press, 2026).

The socviz package contains about thirty datasets and a
number of utility and convenience functions used in Data Visualization: A Practical
Introduction and of use to people producing data visualizations
with R and ggplot.
To install the package, you can follow the instructions in the
Preface to the book. Alternatively, and at a minimum, first download and
install R for MacOS, Windows or Linux, as appropriate.
Launch R, then type the following code at the Console prompt
(>), hitting return at the end of each line:
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 in the package and at https://kjhealy.github.io/socviz/reference/.