Get Election Summary
get_election_summary(data = NULL, data_structure = "tidy", api_key = Sys.getenv("DATAGOV_API_KEY"), district = NULL, cycle = NULL, office = NULL, election_full = NULL, state = NULL)
data | A dataframe or tibble. Usually this will be the returned result of search_elections(). If columns called cycle, office, district, and state are in the table, . Either this argument or candidate_id is required. |
---|---|
data_structure | A character describing how you want OpenFEC results. Options are 'tidy', 'list', or 'both.' Choose list for raw results. |
api_key | API key for https://api.data.gov. Get one at https://api.data.gov/signup. |
district | Two-digit US House distirict of the office the candidate is running for. Presidential, Senate and House at-large candidates will have District 00. |
cycle | Two-year election cycle in which a candidate runs for office. Calculated from FEC Form 2. The cycle begins with an odd year and is named for its ending, even year. This cycle follows the traditional house election cycle and subdivides the presidential and Senate elections into comparable two-year blocks. To see data for the entire four years of a presidential term or six years of a senatorial term, you will need the election_full flag. |
office | Federal office candidate runs for: H, S or P |
election_full | Aggregate values over full election period |
state | US state or territory where a candidate runs for office |