Precinct level results from the 2020 general election for all Iowa precincts (except for Scott county). Precinct level election results for the US was provided under an MIT license by the NYTimes UpShot team at from https://github.com/TheUpshot/presidential-precinct-map-2020 The data provided here only covers Iowa precincts.

ia_election_2020

Format

A tibble with 1597 rows and 7 columns

GEOID

unique identifier for the precinct: 5-digit zipcode followed by the precinct name or ID

votes_total

numeric, number of total votes

votes_dem

numeric value, number of votes for Joseph Biden

votes_rep

numeric value, number of votes for Donald Trump

pct_dem_lead

numeric value, indicating the percent of the democratic lead over the republican

votes_per_sqkm

numeric value, number of votes per square kilometer

geometry

sf object of precinct level maps

Source

https://github.com/TheUpshot/presidential-precinct-map-2020

Author

NY Times Upshot

Examples

library(sf) library(leaflet) pal <- colorNumeric(palette=c("Darkred", "White", "Darkblue"), reverse = FALSE, domain = range(ia_election_2020$pct_dem_lead, na.rm=TRUE)) # Percent of Democratic lead over the Republican ia_election_2020 %>% leaflet() %>% addTiles() %>% addPolygons(fillColor = ~pal(pct_dem_lead), fillOpacity = .75, stroke=0, opacity = .7, label=~GEOID) %>% addLegend(pal=pal, values = range(ia_election_2020$pct_dem_lead, na.rm=TRUE))