Skip to content

baumer-lab/fec20

Repository files navigation

fec20

Lifecycle: experimental CRAN status R build status

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.

Installation

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)

Datasets Included

Full Datasets

  • candidates: candidates registered with the FEC during the 2019-2020 election cycle
  • committees: committees registered with the FEC during the 2019-2020 election cycle
  • campaigns: the House/Senate current campaigns
  • pac: Political Action Committee (PAC) and party summary financial information
  • states: geographical information about the 50 states

Sample Datasets (with 1000 random rows each)

  • individuals: individual contributions to candidates/committees during the 2020 election cycle
  • contributions: candidates and their contributions from committees during the 2020 election cycle
  • expenditures: the operating expenditures
  • transactions: transactions between committees

Forthcoming Datasets

There are 3 forthcoming datasets that contain results from the House, Senate, and Presidential elections.

Functions Included

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.33GB
  • read_all_contributions() ~ 28.9MB
  • read_all_expenditures() ~ 65.6MB
  • read_all_transactions() ~ 235MB

How is the data relational?

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.

Usage and Examples

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.

See Also

If you are interested in political data, check out the following related packages:

Contributors

About

data from the Federal Election Commission for the 2019-2020 election cycle

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages