Week 9
More ggplot2

Soci—269

Sakeef M. Karim
Amherst College

AN INTRODUCTION TO QUANTITATIVE SOCIOLOGY—CULTURE & POWER

Mapping with ggplot2
October 27th

Reminders

The Cummings Lecture

Title

Something Between Us
The Everyday Walls of American Life, and How to Take Them Down

Description

Click to Expand or Close

Scroll to access the entire description.

In 2016, Anand Pandian was alarmed by Donald Trump’s harsh attacks on immigrants to the United States, the appeal of that politics of anger and fear. In the years that followed, he crisscrossed the country seeking out fellow Americans with markedly different social and political commitments, trying to understand the forces that have hardened our suspicions of others. The result is Something Between Us, a groundbreaking and ultimately hopeful exploration of the ruptures in our social fabric, and courageous efforts to rebuild a collective life beyond them. Through vivid encounters with Americans of many kinds, Pandian shares tools to think beyond the twists and turns of our bracing present.

Reminders

Coding Assignment in

Coding Assignment Deadline

Your first coding assignment is due by 8:00 PM on Tuesday, November 4th.

Reminders

Coding Assignment in

Assignment instructions are available online.

Today’s Preliminaries

Today’s Packages

Launch RStudio and run the following code:

# NEW PACKAGES ------------------------------------------------------------

week9_1 <- c("scales", "patchwork", "htmltools",  "leafpop", "leaflet", 
             "mapview", "usmapdata", "usmap", "mapcan", "cancensus",
             "tidycensus",  "geojsonsf", "tidygeocoder",  
             "rnaturalearthdata", "rnaturalearth", "ggspatial", 
             "terra", "sp", "sf", "gt", "colorspace")

install.packages(week9_1)

Give me a when all the packages have been installed.

Today’s Script File

You can access today’s script file here.

Our Data

You can access the data for today’s session by
executing the following code:

load(url("https://github.com/sakeefkarim/soci-269-f25/raw/refs/heads/main/data/week%209/week9.RData"))

Our Data

Let’s Launch RStudio

Note

The rest of today’s session will take place in RStudio!

Extra: Map Projections

Wrapping Up Module II
October 29th

Reminders

Coding Assignment in

Coding Assignment Deadline

Your first coding assignment is due by 8:00 PM on Tuesday, November 4th.

Reminders

Coding Assignment in

Assignment instructions are available online.

Today’s Preliminaries

Today’s Packages

Launch RStudio and run the following code:

# A FINAL SUITE OF PACKAGES (YOU MAY HAVE SOME OF THESE ALREADY)

week9_2 <- c("see", "ggthemes", "ggdist", "ggrepel")

install.packages(week9_2)

Give me a when all the packages have been installed.

Today’s Script File

You can access today’s script file here.

Our Data

You can access the data for today’s session by
executing the following code:

load(url("https://github.com/sakeefkarim/soci-269-f25/raw/refs/heads/main/data/week%209/week9.RData"))

Let’s Launch RStudio

Note

The rest of today’s session will take place in RStudio!

Exercises

Reproduce This Plot

Reproduce the plot below using gapminder and the ggthemes package.

Please click the image to see a larger version of the plot.

Reproduce This Plot

Reproduce the plot below using the see package and geoms from ggdist.

Please click the image to see a larger version of the plot.

Reimagine These Plots

Use ggplot2 and data from the US Census Bureau to reimagine these plots from Abascal’s (2020) survey experiment.

Source

Figure A1  from Abascal (2020)

Source

Figure A2  from Abascal (2020)

You can click on either of these plots to launch a two-image gallery.

Enjoy the Weekend

References

Abascal, Maria. 2020. “Contraction as a Response to Group Threat: Demographic Decline and WhitesClassification of People Who Are Ambiguously White.” American Sociological Review 85(2):298–322. doi: 10.1177/0003122420905127.
Healy, Kieran Joseph. 2019. Data Visualization: A Practical Introduction. Princeton, NJ: Princeton University Press.
Wickham, Hadley, Mine Çetinkaya-Rundel, and Garrett Grolemund. 2023. R for Data Science: Import, Tidy, Transform, Visualize, and Model Data. 2nd edition. Sebastopol, CA: O’Reilly.