Survey

Announcements

Assignments

Tea with a TA

Hang out with the TAs from STA 199! This is a casual conversation and a fun opportunity to meet the members of the STA 199 teaching team. The only rule is these can’t turn into office hours!

Tea with a TA counts as a statistics experience.

Caroline Levenson, TODAY 1p - 2p

Nov 3 is Election Day!

If you’re eligible, VOTE! Find out more information: https://vote.duke.edu/

Other events

Electronic Undergraduate Statistics Research Conference (eUSR) Nov 6, 11:30a - 4:40p

Questions about election

Click here for slides.

Exercises

Today’s data set comes from the US Elections Project. We will focus specifically on early voting data for North Carolina as of November 1, 2020.

The variables are

We first read in the file nc_votes_nov1.shp with the st_read function, saving as nc_votes.

nc_votes <- st_read("data/nc_votes_nov1.shp", quiet = TRUE)

Exercise 1

Examine the data frame nc_votes_nov1. How does it differ from the data frames we have seen before? What type of geometry is associated with each simple feature?

Exercise 2

Let’s use nc_votes to create a map of North Carolina.

ggplot(nc_votes) +
  geom_sf()

Starting with the code above, update the visualization so that the counties have a fill color corresponding to the percentage of requested mail-in ballots that have been returned and accepted. Include informative labels, colors and any other aesthetics.

Exercise 3

  1. Create a map of North Carolina where the counties have a fill color corresponding to the percentage of votes that were cast by mail. Include informative labels, colors and any other aesthetics.

Exercise 4

Create an effective spatial data visualization using these data exploring a topic of your choosing.


Read more about factors to consider when creating election maps: https://www.nytimes.com/interactive/2020/10/30/opinion/election-results-maps.html