elec_winners_map: elec_results_map STILL IN PROGRESS! This function takes a...

Description Usage Arguments Value

View source: R/elec_results_map.R

Description

elec_results_map STILL IN PROGRESS! This function takes a vote results file that has been run through the elec_find_winner and elec_pcts_by_row functions and combined with a GIS shapefile. The result is a Leaflet map with diverging colors for the winning and losing candidates/positions, and an optional turnout layer. Vignette to come.

Usage

1
2
3
elec_winners_map(gisdatafile, winner = "Yes", loser = "No",
  placeCol = "Precinct", wincolors = "Greens", losecolors = "Reds",
  turnout = TRUE, turnoutcolors = "Greens", WinPctMargin = "YesPctMargin")

Arguments

gisdatafile

- sf (simple features) geospatial file combined with vote results data that was already processed with elec_find_winner and elec_pcts_by_row

winner

- string name of winning candidate or position

loser

- string name of losing candidate or position

placeCol

- string name of column that holds place names. If you want names to display as "Precinct 1" you must have a placeCol column that combines the string "Precinct " with the precinct number.

wincolors

- string name of ColorBrewer palette. Defaults to "Greens."

losecolors

- string name of ColorBrewer palette. Defaults to "Reds."

turnout

- logical Whether data includes a column named Turnout with turnout percents as a fraction

turnoutcolors

- string name of ColorBrewer palette. Defaults to "Greens."

WinPctMargin

- string name of column with the difference between the winning percent and losing percent for each place. May need to be calculated manually.

Value

leaflet object


smach/relectionutils documentation built on May 30, 2019, 3:06 a.m.