aggregate_party_votes: Aggregate votes for a geographic unity by political party

Description Usage Arguments Value Examples

View source: R/data-manipulation.R

Description

Aggregate votes for a geographic unity by political party

Usage

1
2
aggregate_party_votes(data, geography = c("county"),
  parties = c("Federalist", "Democratic-Republican"))

Arguments

data

A data frame returned by vote_counts.

geography

The geography to aggregate by for mapping. For instance, "county".

parties

The parties to explicitly keep by name. All other parties, along with unaffiliated candidates, will be collapsed into "other".

Value

A data frame with one row for each geographic unit (e.g. for each county) in the data frame. There will be columns for each party, giving their votes recorded and vote percentage, along with the total vote in that geographic unit.

Examples

1
2
votes <- vote_counts("meae.congressional.congress05.ny.county")
aggregate_party_votes(votes)

mapping-elections/mappingelections documentation built on July 24, 2019, 9:42 a.m.