Precinct and district shapefiles are published by the Secretary of State. Election results of the 2016 general election are added to each precinct.

ia_precincts

Format

A data frame with 1690 rows and 16 variables:

COUNTY

county

DISTRICT

DISTRICT, precinct and NAME are used as names of a precinct.

precinct

DISTRICT, precinct and NAME are used as names of a precinct.

NAME

DISTRICT, precinct and NAME are used as names of a precinct.

POPULATION

population of the precinct.

Votes16

Total number of votes cast in the US general election for US President.

PctRep16

Percent of votes in the district cast for the candidate of the Republican Party

PctDem16

Percent of votes in the district cast for the candidate of the Democratic Party

PctLib16

Percent of votes in the district cast for the candidate of the Libertarian Party

PctOther16

Percent of votes in the district cast for a candidate of an other party.

House_Dist

House district affiliation

Senate_Dis

Senate district affiliation

Congressio

Congression district affiliation

AREA

Area of the district.

Shape_Leng

Numeric value derived from polygon.

geometry

sfc object of polygons describing each district.

Source

https://sos.iowa.gov/elections/maps/shapefiles.html

Examples

library(leaflet) pal <- colorNumeric(palette=c("Darkred", "White", "Darkblue"), reverse = TRUE, domain = range(ia_precincts$PctRep16 - ia_precincts$PctDem16, na.rm=TRUE)) ia_precincts %>% leaflet() %>% addTiles() %>% addPolygons(fillColor = ~pal(PctRep16-PctDem16), fillOpacity = .75, stroke=0, opacity = 1, label=~NAME) %>% addLegend(pal=pal, values = range(ia_precincts$PctRep16 - ia_precincts$PctDem16, na.rm=TRUE))