Get financial totals. If data_structure is the default 'tidy', returns a tibble with notable columns 'amount' and 'type_of_funds'. Use tidyfec_filters to more conveniently filter on 'type_of_funds'.
get_candidate_totals(data = NULL, candidate_id = NULL, data_structure = "tidy", sort_null_only = NULL, cycle = NULL, sort = NULL, designation = NULL, type = NULL, full_election = TRUE, api_key = Sys.getenv("DATAGOV_API_KEY"), message = TRUE)
data | A dataframe or tibble. Usually this will be the returned result of search_candidates(). If a column is called 'candidate_id', get_candidate_totals() will return results for all IDs in that column and will attempt to join data to the result by candidate_id. Either this argument or candidate_id is required. |
---|---|
candidate_id | A character vector of candidate ids to get financial totals for. Either this argument or a dataframe containing a column called 'candidate_id' passed in the 'data' argument is required. |
data_structure | A character describing how you want OpenFEC results. Options are 'tidy', 'list', or 'both.' Choose list for raw results. |
sort_null_only | Toggle that filters out all rows having sort column that is non-null. |
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. |
sort | Provide a field to sort by. Use - for descending order. |
designation | The one-letter designation code of the organization: - A: authorized by a candidate - J: joint fundraising committee - P: principal campaign committee of a candidate - U: unauthorized - B: lobbyist/registrant PAC - D: leadership PAC |
type | The one-letter type code of the organization: - C: communication cost - D: delegate - E: electioneering communication - H: House - I: independent expenditor (person or group) - N: PAC - nonqualified - O: independent expenditure-only (super PACs) - P: presidential - Q: PAC - qualified - S: Senate - U: single candidate independent expenditure - V: PAC with non-contribution account, nonqualified - W: PAC with non-contribution account, qualified - X: party, nonqualified - Y: party, qualified - Z: national party non-federal account |
full_election | Get totals for full election period. Boolean. |
api_key | API key for https://api.data.gov. Get one at https://api.data.gov/signup. |
OpenFEC Documentation: This endpoint provides information about a committee's Form 3, Form 3X, or Form 3P financial reports, which are aggregated by two-year period. We refer to two-year periods as a cycle.