List elections by cycle, office, state, and district. Includes information about incumbents.
search_elections(data_structure = "tidy", api_key = Sys.getenv("DATAGOV_API_KEY"), cycle = NULL, office = NULL, sort_hide_null = NULL, zip = NULL, sort = NULL, district = NULL, state = NULL, sort_null_only = NULL)
A character describing how you want OpenFEC results. Options are 'tidy', 'list', or 'both.' Choose list for raw results.
API key for https://api.data.gov. Get one at https://api.data.gov/signup.
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.
"house", "senate", or "president."
Hide null values on sorted column(s).
Provide a field to sort by. Use - for descending order.
Two-digit US House distirict of the office the candidate is running for. Presidential, Senate and House at-large candidates will have District 00.
US state or territory where a candidate runs for office
Toggle that filters out all rows having sort column that is non-null