join_dist: Join by a single district identifier (congerss, state hosue)...

View source: R/join_to_party.R

join_distR Documentation

Join by a single district identifier (congerss, state hosue) or county

Description

Calls join_1col internally

Usage

join_dist(tbl, cands, office)

join_county(tbl, cands, office)

join_countydist(tbl, cands, office)

Arguments

tbl

variables must be of the type 'office_vote', 'office_dist' (if dist) and county for vote name and district, respectively.

cands

A table of candidates. Must have variables elec, dist, county, ballot_name, party_num, contest_type

office

NSE short form of the office in question

Details

Use join_dist for an office based on a single district number (like USHOU or state house, use join_county for an office countywide (like Sheriff), join_countydist for an office based on both (like county council). All are wrappers to join_1col. We simplify the problem into just a one-variable merge.

It creates new columns for each contest: contest_party, a numeric -1 (D), 0 (Abstain / 3rd Party / Write-in), 1 (R), and contest_dist, a number for the district of the voter of the contest in question if applicable, and contest_ncand, the number of D-Rs in the district (does not count 3rd party)


kuriwaki/ballot documentation built on May 1, 2023, 9:55 p.m.