vignettes/get-aggregated.Rmd
get-aggregated.Rmd
These functions cover anything that isn’t itemized data. Want to know how much money a candidate has raised? Look at data from every filing their committee has ever made? How much outside money has been spent in an election?
As shown in these examples, the tidyusafec suggested workflow is to pipe (%>%
) the results of a function with the search_
prefix into a function with the get_
prefix.
get_candidate_totals()
by default currently returns a tibble with information about a candidate’s funding totals, what you would typically see on the summary tables of the FEC site.get_committee_reports()
by default currently returns a tibble with information about committee reports. Mostly useful for looking at quarterly report trends.get_election_summary()
by default currently returns a tibble with financial summaries by election.library(tidyverse)
library(tidyusafec)
save_datagov_apikey(key = "DATA.GOV KEY STRING")
Each row of the tibble returned is a specific total given in the amount
column. The type_of_funds
column shows what that amount applies to. While you can use the function by itself, piping the results of search_candidates
will automatically join additional columns with context like name, office, state, etc.
va_05_house_candidates <- search_candidates(election_year = 2018, office = "H", state = "VA", district = "05", candidate_status = "C") %>%
get_candidate_totals()
candidate_id | coverage_start_date | full_election | coverage_end_date | last_report_year | cycle | last_report_type_full | last_beginning_image_number | type_of_funds | amount | load_date | last_file_date | election_years | party | candidate_status | office_full | state | federal_funds_flag | has_raised_funds | office | election_districts | name | district_number | cycles | incumbent_challenge | party_full | first_file_date | active_through | incumbent_challenge_full | last_f2_date | district | committee_id | committee_name | treasurer_name | earliest_cycle | latest_cycle | earliest_election_year | latest_election_year |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
H8VA05155 | 2017-07-13T00:00:00+00:00 | TRUE | 2018-04-15T00:00:00+00:00 | 2018 | 2018 | PRE-CONVENTION | 201804239111720149 | loan_repayments | 0.00 | 2017-10-16T21:00:02 | 2017-07-24 | list(2018) | DEM | C | House | VA | FALSE | TRUE | H | list(“05”) | COCKBURN, LESLIE | 5 | list(2018) | C | DEMOCRATIC PARTY | 2017-07-13 | 2018 | Challenger | 2017-07-24 | 05 | C00650366 | LESLIE COCKBURN FOR CONGRESS | MELE, STEVE | 2018 | 2018 | 2018 | 2018 |
H8VA05148 | 2017-07-01T00:00:00+00:00 | TRUE | 2018-04-15T00:00:00+00:00 | 2018 | 2018 | PRE-CONVENTION | 201804209110419709 | loan_repayments | 0.00 | 2017-10-24T21:01:05 | 2017-07-02 | list(2018) | DEM | C | House | VA | FALSE | TRUE | H | list(“05”) | CULLOP, BENJAMIN NIEL | 5 | list(2018) | C | DEMOCRATIC PARTY | 2017-07-02 | 2018 | Challenger | 2017-07-02 | 05 | C00649020 | CULLOP FOR CONGRESS | VANDEVER, JASON | 2018 | 2018 | 2018 | 2018 |
H6VA05142 | 2017-01-01T00:00:00+00:00 | TRUE | 2018-04-08T00:00:00+00:00 | 2018 | 2018 | PRE-CONVENTION | 201804169108269935 | loan_repayments | 0.00 | 2017-05-23T07:10:20 | 2017-05-16 | list(2016, 2018) | REP | C | House | VA | FALSE | TRUE | H | list(“05”, “05”) | GARRETT, THOMAS ALEXANDER MR. JR. | 5 | list(2016, 2018) | I | REPUBLICAN PARTY | 2016-01-27 | 2018 | Incumbent | 2017-05-16 | 05 | C00607101 | TOM GARRETT FOR CONGRESS | WOODFIN, CHRISTOPHER MONTGOMERY MR. ESQ. | 2016 | 2018 | 2016 | 2018 |
H6VA05142 | 2016-01-01T00:00:00+00:00 | TRUE | 2016-12-31T00:00:00+00:00 | 2016 | 2016 | YEAR-END | 201702029042407932 | loan_repayments | 20000.00 | 2017-05-23T07:10:20 | 2017-05-16 | list(2016, 2018) | REP | C | House | VA | FALSE | TRUE | H | list(“05”, “05”) | GARRETT, THOMAS ALEXANDER MR. JR. | 5 | list(2016, 2018) | I | REPUBLICAN PARTY | 2016-01-27 | 2018 | Incumbent | 2017-05-16 | 05 | C00607101 | TOM GARRETT FOR CONGRESS | WOODFIN, CHRISTOPHER MONTGOMERY MR. ESQ. | 2016 | 2018 | 2016 | 2018 |
H8VA05114 | 2017-04-01T00:00:00+00:00 | TRUE | 2018-04-15T00:00:00+00:00 | 2018 | 2018 | PRE-CONVENTION | 201804239111725619 | loan_repayments | 0.00 | 2017-10-01T20:55:35 | 2017-10-01 | list(2018) | DEM | C | House | VA | FALSE | TRUE | H | list(“05”) | HUFFSTETLER, ROGER DEAN RD | 5 | list(2018) | C | DEMOCRATIC PARTY | 2017-04-18 | 2018 | Challenger | 2017-10-01 | 05 | C00637918 | FRIENDS OF RD | JOHNSON, SARAH | 2018 | 2018 | 2018 | 2018 |
H8VA05130 | 2017-04-01T00:00:00+00:00 | TRUE | 2018-03-31T00:00:00+00:00 | 2018 | 2018 | APRIL QUARTERLY | 201804139108013236 | loan_repayments | 0.00 | 2017-10-16T21:00:02 | 2017-05-26 | list(2018) | DEM | C | House | VA | FALSE | TRUE | H | list(“05”) | SLATE, ADAM | 5 | list(2018) | C | DEMOCRATIC PARTY | 2017-05-26 | 2018 | Challenger | 2017-05-26 | 05 | C00639153 | ADAM SLATE FOR CONGRESS | MCREYNOLDS, JAMES M. | 2018 | 2018 | 2018 | 2018 |
H8VA05122 | 2017-04-01T00:00:00+00:00 | TRUE | 2018-03-31T00:00:00+00:00 | 2018 | 2018 | APRIL QUARTERLY | 201804159108200524 | loan_repayments | 0.00 | 2017-09-27T20:56:17 | 2017-05-17 | list(2018) | DEM | C | House | VA | FALSE | TRUE | H | list(“05”) | SNEATHERN, ANDREW | 5 | list(2018) | C | DEMOCRATIC PARTY | 2017-05-17 | 2018 | Challenger | 2017-05-17 | 05 | C00640698 | SNEATHERN FOR CONGRESS | PAULE-CARRES, PATTI | 2018 | 2018 | 2018 | 2018 |
H8VA05155 | 2017-07-13T00:00:00+00:00 | TRUE | 2018-04-15T00:00:00+00:00 | 2018 | 2018 | PRE-CONVENTION | 201804239111720149 | last_net_operating_expenditures | 42137.83 | 2017-10-16T21:00:02 | 2017-07-24 | list(2018) | DEM | C | House | VA | FALSE | TRUE | H | list(“05”) | COCKBURN, LESLIE | 5 | list(2018) | C | DEMOCRATIC PARTY | 2017-07-13 | 2018 | Challenger | 2017-07-24 | 05 | C00650366 | LESLIE COCKBURN FOR CONGRESS | MELE, STEVE | 2018 | 2018 | 2018 | 2018 |
H8VA05148 | 2017-07-01T00:00:00+00:00 | TRUE | 2018-04-15T00:00:00+00:00 | 2018 | 2018 | PRE-CONVENTION | 201804209110419709 | last_net_operating_expenditures | 28287.72 | 2017-10-24T21:01:05 | 2017-07-02 | list(2018) | DEM | C | House | VA | FALSE | TRUE | H | list(“05”) | CULLOP, BENJAMIN NIEL | 5 | list(2018) | C | DEMOCRATIC PARTY | 2017-07-02 | 2018 | Challenger | 2017-07-02 | 05 | C00649020 | CULLOP FOR CONGRESS | VANDEVER, JASON | 2018 | 2018 | 2018 | 2018 |
H6VA05142 | 2017-01-01T00:00:00+00:00 | TRUE | 2018-04-08T00:00:00+00:00 | 2018 | 2018 | PRE-CONVENTION | 201804169108269935 | last_net_operating_expenditures | 11516.07 | 2017-05-23T07:10:20 | 2017-05-16 | list(2016, 2018) | REP | C | House | VA | FALSE | TRUE | H | list(“05”, “05”) | GARRETT, THOMAS ALEXANDER MR. JR. | 5 | list(2016, 2018) | I | REPUBLICAN PARTY | 2016-01-27 | 2018 | Incumbent | 2017-05-16 | 05 | C00607101 | TOM GARRETT FOR CONGRESS | WOODFIN, CHRISTOPHER MONTGOMERY MR. ESQ. | 2016 | 2018 | 2016 | 2018 |
H6VA05142 | 2016-01-01T00:00:00+00:00 | TRUE | 2016-12-31T00:00:00+00:00 | 2016 | 2016 | YEAR-END | 201702029042407932 | last_net_operating_expenditures | 34037.67 | 2017-05-23T07:10:20 | 2017-05-16 | list(2016, 2018) | REP | C | House | VA | FALSE | TRUE | H | list(“05”, “05”) | GARRETT, THOMAS ALEXANDER MR. JR. | 5 | list(2016, 2018) | I | REPUBLICAN PARTY | 2016-01-27 | 2018 | Incumbent | 2017-05-16 | 05 | C00607101 | TOM GARRETT FOR CONGRESS | WOODFIN, CHRISTOPHER MONTGOMERY MR. ESQ. | 2016 | 2018 | 2016 | 2018 |
H8VA05114 | 2017-04-01T00:00:00+00:00 | TRUE | 2018-04-15T00:00:00+00:00 | 2018 | 2018 | PRE-CONVENTION | 201804239111725619 | last_net_operating_expenditures | 58715.92 | 2017-10-01T20:55:35 | 2017-10-01 | list(2018) | DEM | C | House | VA | FALSE | TRUE | H | list(“05”) | HUFFSTETLER, ROGER DEAN RD | 5 | list(2018) | C | DEMOCRATIC PARTY | 2017-04-18 | 2018 | Challenger | 2017-10-01 | 05 | C00637918 | FRIENDS OF RD | JOHNSON, SARAH | 2018 | 2018 | 2018 | 2018 |
H8VA05130 | 2017-04-01T00:00:00+00:00 | TRUE | 2018-03-31T00:00:00+00:00 | 2018 | 2018 | APRIL QUARTERLY | 201804139108013236 | last_net_operating_expenditures | 61.11 | 2017-10-16T21:00:02 | 2017-05-26 | list(2018) | DEM | C | House | VA | FALSE | TRUE | H | list(“05”) | SLATE, ADAM | 5 | list(2018) | C | DEMOCRATIC PARTY | 2017-05-26 | 2018 | Challenger | 2017-05-26 | 05 | C00639153 | ADAM SLATE FOR CONGRESS | MCREYNOLDS, JAMES M. | 2018 | 2018 | 2018 | 2018 |
H8VA05122 | 2017-04-01T00:00:00+00:00 | TRUE | 2018-03-31T00:00:00+00:00 | 2018 | 2018 | APRIL QUARTERLY | 201804159108200524 | last_net_operating_expenditures | 89583.63 | 2017-09-27T20:56:17 | 2017-05-17 | list(2018) | DEM | C | House | VA | FALSE | TRUE | H | list(“05”) | SNEATHERN, ANDREW | 5 | list(2018) | C | DEMOCRATIC PARTY | 2017-05-17 | 2018 | Challenger | 2017-05-17 | 05 | C00640698 | SNEATHERN FOR CONGRESS | PAULE-CARRES, PATTI | 2018 | 2018 | 2018 | 2018 |
H8VA05155 | 2017-07-13T00:00:00+00:00 | TRUE | 2018-04-15T00:00:00+00:00 | 2018 | 2018 | PRE-CONVENTION | 201804239111720149 | transfers_from_other_authorized_committee | 0.00 | 2017-10-16T21:00:02 | 2017-07-24 | list(2018) | DEM | C | House | VA | FALSE | TRUE | H | list(“05”) | COCKBURN, LESLIE | 5 | list(2018) | C | DEMOCRATIC PARTY | 2017-07-13 | 2018 | Challenger | 2017-07-24 | 05 | C00650366 | LESLIE COCKBURN FOR CONGRESS | MELE, STEVE | 2018 | 2018 | 2018 | 2018 |
H8VA05148 | 2017-07-01T00:00:00+00:00 | TRUE | 2018-04-15T00:00:00+00:00 | 2018 | 2018 | PRE-CONVENTION | 201804209110419709 | transfers_from_other_authorized_committee | 0.00 | 2017-10-24T21:01:05 | 2017-07-02 | list(2018) | DEM | C | House | VA | FALSE | TRUE | H | list(“05”) | CULLOP, BENJAMIN NIEL | 5 | list(2018) | C | DEMOCRATIC PARTY | 2017-07-02 | 2018 | Challenger | 2017-07-02 | 05 | C00649020 | CULLOP FOR CONGRESS | VANDEVER, JASON | 2018 | 2018 | 2018 | 2018 |
H6VA05142 | 2017-01-01T00:00:00+00:00 | TRUE | 2018-04-08T00:00:00+00:00 | 2018 | 2018 | PRE-CONVENTION | 201804169108269935 | transfers_from_other_authorized_committee | 0.00 | 2017-05-23T07:10:20 | 2017-05-16 | list(2016, 2018) | REP | C | House | VA | FALSE | TRUE | H | list(“05”, “05”) | GARRETT, THOMAS ALEXANDER MR. JR. | 5 | list(2016, 2018) | I | REPUBLICAN PARTY | 2016-01-27 | 2018 | Incumbent | 2017-05-16 | 05 | C00607101 | TOM GARRETT FOR CONGRESS | WOODFIN, CHRISTOPHER MONTGOMERY MR. ESQ. | 2016 | 2018 | 2016 | 2018 |
H6VA05142 | 2016-01-01T00:00:00+00:00 | TRUE | 2016-12-31T00:00:00+00:00 | 2016 | 2016 | YEAR-END | 201702029042407932 | transfers_from_other_authorized_committee | 12889.20 | 2017-05-23T07:10:20 | 2017-05-16 | list(2016, 2018) | REP | C | House | VA | FALSE | TRUE | H | list(“05”, “05”) | GARRETT, THOMAS ALEXANDER MR. JR. | 5 | list(2016, 2018) | I | REPUBLICAN PARTY | 2016-01-27 | 2018 | Incumbent | 2017-05-16 | 05 | C00607101 | TOM GARRETT FOR CONGRESS | WOODFIN, CHRISTOPHER MONTGOMERY MR. ESQ. | 2016 | 2018 | 2016 | 2018 |
H8VA05114 | 2017-04-01T00:00:00+00:00 | TRUE | 2018-04-15T00:00:00+00:00 | 2018 | 2018 | PRE-CONVENTION | 201804239111725619 | transfers_from_other_authorized_committee | 146608.46 | 2017-10-01T20:55:35 | 2017-10-01 | list(2018) | DEM | C | House | VA | FALSE | TRUE | H | list(“05”) | HUFFSTETLER, ROGER DEAN RD | 5 | list(2018) | C | DEMOCRATIC PARTY | 2017-04-18 | 2018 | Challenger | 2017-10-01 | 05 | C00637918 | FRIENDS OF RD | JOHNSON, SARAH | 2018 | 2018 | 2018 | 2018 |
H8VA05130 | 2017-04-01T00:00:00+00:00 | TRUE | 2018-03-31T00:00:00+00:00 | 2018 | 2018 | APRIL QUARTERLY | 201804139108013236 | transfers_from_other_authorized_committee | 0.00 | 2017-10-16T21:00:02 | 2017-05-26 | list(2018) | DEM | C | House | VA | FALSE | TRUE | H | list(“05”) | SLATE, ADAM | 5 | list(2018) | C | DEMOCRATIC PARTY | 2017-05-26 | 2018 | Challenger | 2017-05-26 | 05 | C00639153 | ADAM SLATE FOR CONGRESS | MCREYNOLDS, JAMES M. | 2018 | 2018 | 2018 | 2018 |