fec20 contains data from the Federal Election Commission (FEC) website pertaining to candidates, committees, results (forthcoming), contributions from committees and individuals, and other financial data for the United States 2019-2020 election cycle. Additionally, for the datasets that are included as samples, the package includes functions that import the full versions.
This package is a natural successor of the fec16
R
package (that contains data from
the 2015-2016 elections). fec16
is available on CRAN.
Install the development version from GitHub:
# If you haven't installed the remotes package yet, do so:
# install.packages("remotes")
remotes::install_github("baumer-lab/fec20")
# Load package
library(fec20)
candidates
: candidates registered with the FEC during the 2019-2020 election cyclecommittees
: committees registered with the FEC during the 2019-2020 election cyclecampaigns
: the House/Senate current campaignspac
: Political Action Committee (PAC) and party summary financial informationstates
: geographical information about the 50 states
individuals
: individual contributions to candidates/committees during the 2020 election cyclecontributions
: candidates and their contributions from committees during the 2020 election cycleexpenditures
: the operating expenditurestransactions
: transactions between committees
There are 3 forthcoming datasets that contain results from the House, Senate, and Presidential elections.
The following functions retrieve the entire datasets for the sampled
ones listed above. The size of the raw file that is downloaded by
calling each function is given for reference. All functions have an
argument n_max
which defaults to the entire dataset but the user can
specify the max length of the dataset to be loaded via this argument.
read_all_individuals()
~ 9.33GBread_all_contributions()
~ 28.9MBread_all_expenditures()
~ 65.6MBread_all_transactions()
~ 235MB
The headers of each table show the dataset name. The underlined variables are primary keys while all the others are foreign keys. The arrows show how the datasets are connected.
The diagram is built using the dm
R package. The code can be found in
data-raw/dm.R
.
All the included datasets in fec20
are lazy-loaded, so you can easily
load it via:
head(candidates)
?candidates
# If using RStudio:
View(candidates)
To use any of the read_all_*
functions, you can run:
all_contributions <- read_all_expenditures()
For example usage of the datasets, please view the vignette.
If you are interested in political data, check out the following related packages: