ia_precincts.Rd
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
A data frame with 1690 rows and 16 variables:
county
DISTRICT, precinct and NAME are used as names of a precinct.
DISTRICT, precinct and NAME are used as names of a precinct.
DISTRICT, precinct and NAME are used as names of a precinct.
population of the precinct.
Total number of votes cast in the US general election for US President.
Percent of votes in the district cast for the candidate of the Republican Party
Percent of votes in the district cast for the candidate of the Democratic Party
Percent of votes in the district cast for the candidate of the Libertarian Party
Percent of votes in the district cast for a candidate of an other party.
House district affiliation
Senate district affiliation
Congression district affiliation
Area of the district.
Numeric value derived from polygon.
sfc object of polygons describing each district.
https://sos.iowa.gov/elections/maps/shapefiles.html
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))