Package rcv. August 11, 2017

Similar documents
Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package fastdummies. January 8, 2018

Package censusr. R topics documented: June 14, Type Package Title Collect Data from the Census API Version 0.0.

Package jpmesh. December 4, 2017

Package messaging. May 27, 2018

Package bisect. April 16, 2018

Package oec. R topics documented: May 11, Type Package

Package calpassapi. August 25, 2018

Package validara. October 19, 2017

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package repec. August 31, 2018

Package qualmap. R topics documented: September 12, Type Package

Package datasets.load

Package cancensus. February 4, 2018

Package robotstxt. November 12, 2017

Package sfc. August 29, 2016

Package facerec. May 14, 2018

Package statsdk. September 30, 2017

Package SEMrushR. November 3, 2018

Package widyr. August 14, 2017

Election Night Reporting Quick Start Guide

Package crossword.r. January 19, 2018

Package splithalf. March 17, 2018

Package comparedf. February 11, 2019

Package IATScore. January 10, 2018

Package tidytransit. March 4, 2019

Package gtrendsr. October 19, 2017

Package gtrendsr. August 4, 2018

Package fitbitscraper

Package knitrprogressbar

Package ezsummary. August 29, 2016

Package wikitaxa. December 21, 2017

Package docxtools. July 6, 2018

Package postal. July 27, 2018

Package rgho. R topics documented: January 18, 2017

Package projector. February 27, 2018

Package GetITRData. October 22, 2017

Package fingertipsr. May 25, Type Package Version Title Fingertips Data for Public Health

Package editdata. October 7, 2017

Package ECctmc. May 1, 2018

Package datapasta. January 24, 2018

Package githubinstall

Package gggenes. R topics documented: November 7, Title Draw Gene Arrow Maps in 'ggplot2' Version 0.3.2

Package tidyimpute. March 5, 2018

Package fastqcr. April 11, 2017

Package dkanr. July 12, 2018

Package canvasxpress

Package triebeard. August 29, 2016

Package tidylpa. March 28, 2018

Package rsppfp. November 20, 2018

Package loggit. April 9, 2018

Package spark. July 21, 2017

Package sfdct. August 29, 2017

Package omu. August 2, 2018

Package essurvey. August 23, 2018

Package wrswor. R topics documented: February 2, Type Package

Package nngeo. September 29, 2018

Package ecoseries. R topics documented: September 27, 2017

Package postgistools

Package TrafficBDE. March 1, 2018

Package internetarchive

Package areal. December 31, 2018

Package kirby21.base

Package ggimage. R topics documented: November 1, Title Use Image in 'ggplot2' Version 0.0.7

Package raker. October 10, 2017

Package jstree. October 24, 2017

Package dbx. July 5, 2018

Package keyholder. May 19, 2018

Package textrank. December 18, 2017

Package embed. November 19, 2018

Package available. November 17, 2017

Package clipr. June 23, 2018

Package epitab. July 4, 2018

Package readxl. April 18, 2017

Package mdftracks. February 6, 2017

Package pdfsearch. July 10, 2018

Package tibble. August 22, 2017

Package modules. July 22, 2017

Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package kdtools. April 26, 2018

Package driftr. June 14, 2018

Package PCADSC. April 19, 2017

Package spelling. December 18, 2017

Package reval. May 26, 2015

Package bigreadr. R topics documented: August 13, Version Date Title Read Large Text Files

Package heims. January 25, 2018

Package vip. June 15, 2018

Package d3plus. September 25, 2017

Package liftr. R topics documented: May 14, Type Package

Package opencage. January 16, 2018

Package ruler. February 23, 2018

Package data.world. April 5, 2018

Package textrecipes. December 18, 2018

Package bikedata. April 27, 2018

Package tidytree. June 13, 2018

Package semver. January 6, 2017

Package nlgeocoder. October 8, 2018

Package vinereg. August 10, 2018

Package rzeit2. January 7, 2019

Package guardianapi. February 3, 2019

Transcription:

Type Package Title Ranked Choice Voting Version 0.2.1 Package rcv August 11, 2017 A collection of ranked choice voting data and functions to manipulate, run elections with, and visualize this data and others. It can bring in raw data, transform it into a ballot you can read, and return election results for an RCV contest. URL https://github.com/ds-elections/rcv BugReports https://github.com/ds-elections/rcv/issues License MIT + file LICENSE Encoding UTF-8 LazyData true Depends R (>= 3.3.3) Imports dplyr, tibble, tidyr, readr, stringr RoxygenNote 6.0.1 Suggests alluvial, networkd3, knitr, rmarkdown NeedsCompilation no Author Jay Lee [aut], Matthew Yancheff [aut, cre], Reed College [cph] Maintainer Matthew Yancheff <yanchefm@reed.edu> Repository CRAN Date/Publication 2017-08-11 08:11:33 UTC R topics documented: add_exhausted........................................ 2 approval........................................... 3 cambridge_ballot...................................... 3 1

2 add_exhausted cambridge_clean...................................... 4 cambridge_lookup..................................... 4 characterize......................................... 5 clean_ballot......................................... 5 clean_mn.......................................... 6 elected............................................ 7 import_data......................................... 7 label............................................. 8 make_alluvialdf....................................... 8 make_d3list......................................... 9 minneapolis_mayor_2013.................................. 10 rcv.............................................. 10 rcv_tally........................................... 11 readable........................................... 11 sf_7_results......................................... 12 sf_bos_ballot........................................ 12 sf_bos_clean........................................ 13 sf_bos_lookup........................................ 13 sf_lookup_labelled..................................... 14 Index 15 add_exhausted Adds correct exhausted numbers for a rcv_tally dataframe Adds correct exhausted numbers for a rcv_tally dataframe add_exhausted(results) results A dataframe that comes from rcv_tally() The results dataframe with correct counts for the exhausted votes

approval 3 approval Summarizes the approval rate of the eventual winner(s) Counts what proportion of voters approved of the election winners, defining "approved" as a voter listing the candidate on their ballot approval(results, image, rcvcontest, n = 1) results image rcvcontest the tabulated election results the clean ballot image (optional) The election to calculate results for. If the image contains more than one unique contest, this must be supplied. n the number of candidates being elected (defaults to 1) a numerical vector of length 1 approval(sf_7_results, sf_bos_clean, rcvcontest = "Board of Supervisors, District 7", n = 1) cambridge_ballot Raw ballot image data from a Cambridge, MA RCV election The.rda version of a.csv from a 2005 Cambridge, MA City Council multiwinner RCV election. This data is included as an example of another ballot image format for use with the label function. All Cambridge data is to be used with the "ChoicePlus" format. cambridge_ballot A data frame with 17959 rows and 26 variables

4 cambridge_lookup cambridge_clean Cleaned ballot image data from a San Francisco RCV election A tidied version of cambridge_ballot in a "tall" format, readable to see voters information, including candidate rankings, ward, and precinct. Cleaned with clean_ballot. clean_ballot(cambridge_ballot, b_header = T, cambridge_lookup, l_header = T, format = "ChoicePlus") cambridge_clean A data frame with 108752 rows and 7 variables: pref_voter_id a unique key identifying an individual voter ward which city ward the voter voted in precinct which city precinct the voter voted in style which ballot style the voter had; different styles list different candidates first on the ballot to remove that advantage contest which election this candidate ranking applies to vote_rank the rank given to the candidate by the voter candidate the chosen candidate for the specified vote rank cambridge_lookup Raw lookup data from a Cambridge, MA RCV election The.rda version of a.csv from a 2005 Cambridge, MA City Council multiwinner RCV election. This data is included as an example of another master lookup format for use with the label function. This data includes information other than the candidate names and codes, but we only use the candidate names and codes. cambridge_lookup A data frame with 588 rows and 6 variables

characterize 5 characterize Replaces number string codes in ballot with character strings from lookup Matches codes in the contest_id, tally_type_id, precinct_id, and candidate_id columns in the labelled ballot with codes from the id column in the labelled lookup, then replaces these codes with character values from the description column in the lookup. characterize(ballot, lookup, format) ballot lookup format The labelled ballot data The labelled lookup data A character string detailing the format. Current supported formats are "WinEDS" and "ChoicePlus" (forthcoming), based on common types of software used. Contact creators with suggestions for more formats. The ballot data, but now "readable" so votes can be understood ## Not run: characterize(ballot = sf_ballot_labelled, lookup = sf_lookup_labelled, format = "WinEDS") ## End(Not run) clean_ballot Master one-step cleaning function Wraps import_data, label, and characterize to clean the ballot image in one step. clean_ballot(ballot, b_header, lookup, l_header, format)

6 clean_mn ballot b_header lookup l_header format The raw ballot image Whether the ballot image has a header line or not The raw lookup image Whether the lookup image has a header line or not A character string detailing the format. Current supported formats are "WinEDS" and "ChoicePlus" (forthcoming), based on common types of software used. Contact creators with suggestions for more formats. The ballot data, but now "readable" so votes can be understood clean_ballot(ballot = sf_bos_ballot, b_header = TRUE, lookup = sf_bos_lookup, l_header = TRUE, format = "WinEDS") clean_mn Function for cleaning Minneapolis RCV data The Minneapolis data comes in a different form than SF or Cambridge data. This function optimizes the process for formatting this data. clean_mn(data) data The raw RCV data The data formatted for use with rcv_tally clean_mn(minneapolis_mayor_2013)

elected 7 elected Summarizes which candidates were elected from the results tally Summarizes which candidates were elected from the results tally elected(results, n = 1) results the results tabulated from the election in question n the number of candidates being elected (defaults to 1) a vector of the candidates successfully elected elected(sf_7_results, n = 1) import_data Imports election data Takes data argument supplied, checks file type, and uses appropriate read-in functions to import the data import_data(data, header) data header The file, containing ballot or lookup data Whether the first row of the file is a header or not A data frame

8 make_alluvialdf import_data("http://www.sfelections.org/results/20161108/data/20161206/20161206_masterlookup.txt", header = FALSE) label Separates single column election data frames. Takes a data frame of a single column (i.e. sf_bos_ballot) and splits it into usable named columns. label(data, image, format) data image format A data frame with a single column Whether the data is a "ballot" or "lookup" image A character string detailing the format. Current supported formats are "WinEDS" and "ChoicePlus" (forthcoming), based on common types of software used. Contact creators with suggestions for more formats. A data frame with multiple columns label(data = sf_bos_ballot, image = "ballot", format = "WinEDS") make_alluvialdf Creates a data frame for use with the alluvial package Creates a data frame for use with the alluvial package make_alluvialdf(image, rcvcontest) image rcvcontest A dataframe containing rcv election data The election to calculate results for

make_d3list 9 A dataframe that counts how many ballots follow each unique "path" of candidates through the election rounds ## Not run: make_alluvialdf(image = sf_bos_clean, rcvcontest = "Board of Supervisors, District 7") ## End(Not run) make_d3list Creates a data frame for use with the networkd3 package Creates a data frame for use with the networkd3 package make_d3list(results) results A dataframe containing rcv election results in the format produced by rcv_tally() A list of 2 dataframes that can be used to construct sankey diagrams via the networkd3 package s sankeynetwork() function make_d3list(results = sf_7_results)

10 rcv minneapolis_mayor_2013 Raw ballot data from a Minneapolis, MN RCV election The.rda version of a.csv from a 2013 Minneapolis, MN mayoral RCV election. This data is included as an example of another ballot format for use with ballot functions. minneapolis_mayor_2013 A data frame with 80101 rows and 5 variables Source http://vote.minneapolismn.gov/www/groups/public/@clerk/documents/webcontent/2013-mayor-cvr. xlsx rcv Package: rcv Ranked Choice Voting Details A collection of ranked choice voting data and functions to manipulate, run elections with, and visualize this data and others. It can bring in raw data, transform it into a ballot you can read, and return election results for an RCV contest. rcv Functions import_data(), label(), characterize(), clean_ballot(), clean_mn(), readable(), elected(), approval(), rcv_tally(), add_exhausted(), make_alluvialdf(), make_d3list()

rcv_tally 11 rcv_tally Determines RCV round results in a dataframe Determines RCV round results in a dataframe rcv_tally(image, rcvcontest) image rcvcontest A dataframe containing rcv election data (optional) The election to calculate results for. If the image contains more than one unique contest, this must be supplied. In most cases except for some San Francisco elections, this is unnecessary. A dataframe that contains vote tallies rcv_tally(image = sf_bos_clean, rcvcontest = "Board of Supervisors, District 7") readable Alters ballot dataframe to have each row correspond to a single voter Alters ballot dataframe to have each row correspond to a single voter readable(clean) clean A tidy dataframe that comes from ballot_tidy() A dataframe that can be easily read and understood by humans readable(sf_bos_clean)

12 sf_bos_ballot sf_7_results Tabulated results from a San Francisco RCV election Results from the SF "Board of Supervisors, District 7" election in 2016. Tabulated with rcv_tally. rcv_tally(image = sf_bos_clean, rcvcontest = "Board of Supervisors, District 7") sf_7_results a data frame with 6 rows and 5 variables sf_bos_ballot Raw ballot image data from a San Francisco RCV election The.rda version of a raw.txt file, containing ballot data in numeric form for the 2016 San Francisco Board of Supervisors elections in Districts 1, 3, 5, 7, 9, and 11. sf_bos_ballot A data frame with 643806 rows and 1 variable Source http://www.sfelections.org/results/20161108/data/20161206/20161206_ballotimage.txt

sf_bos_clean 13 sf_bos_clean Cleaned ballot image data from a San Francisco RCV election A tidied version of sf_bos_ballot in a "tall" format, readable to see voters information, including candidate rankings, precinct, and over-/under-vote codings. Cleaned with clean_ballot. clean_ballot(sf_bos_ballot, b_header = T, sf_bos_lookup, l_header = T, format = "WinEDS") sf_bos_clean A data frame with 643806 rows and 9 variables: contest which election this candidate ranking applies to pref_voter_id a unique key identifying an individual voter serial_number the serial number of the voting machine used tally contains information about whether the ballot was cast in early voting, was filed provisionally, and other factors precinct which city precinct the voter voted in vote_rank the rank given to the candidate by the voter; in the San Francisco case can take values of 1, 2, or 3 candidate the chosen candidate for the specified vote rank over_vote a dummy variable, coded 1 if the ballot shows more votes cast than the number of candidates to be elected under_vote a dummy variable, coded 1 if the ballot shows no valid selection made for a candidate sf_bos_lookup Raw ballot lookup data from a San Francisco RCV election. The.rda version of a raw.txt file, containing numeric and character information to match the numeric data in the raw ballot image with the objects these numeric strings refer to. Data refers to the 2016 San Francisco Board of Supervisors elections in Districts 1, 3, 5, 7, 9, and 11. All San Francisco data is to be used with the "WinEDS" format. sf_bos_lookup

14 sf_lookup_labelled Source A data frame with 644 rows and 1 variable http://www.sfelections.org/results/20161108/data/20161206/20161206_masterlookup. txt sf_lookup_labelled Labelled ballot lookup data from a San Francisco RCV election. The.rda version of sf_bos_lookup.rda after the label() function has been applied to it. sf_lookup_labelled A data frame with 644 rows and 7 variables

Index Topic datasets cambridge_ballot, 3 cambridge_clean, 4 cambridge_lookup, 4 minneapolis_mayor_2013, 10 sf_7_results, 12 sf_bos_ballot, 12 sf_bos_clean, 13 sf_bos_lookup, 13 sf_lookup_labelled, 14 add_exhausted, 2 approval, 3 cambridge_ballot, 3 cambridge_clean, 4 cambridge_lookup, 4 characterize, 5 clean_ballot, 5 clean_mn, 6 elected, 7 import_data, 7 label, 8 make_alluvialdf, 8 make_d3list, 9 minneapolis_mayor_2013, 10 rcv, 10 rcv-package (rcv), 10 rcv_tally, 11 readable, 11 sf_7_results, 12 sf_bos_ballot, 12 sf_bos_clean, 13 sf_bos_lookup, 13 sf_lookup_labelled, 14 15