Skip to content

baumer-lab/fec12

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fec12

Lifecycle: experimental CRAN status Travis-CI Build Status

fec12 contains data from the Federal Election Commission (FEC) website pertaining to candidates, committees, results, contributions from committees and individuals, and other financial data for the United States 2011-2012 election cycle. Additionally, for the datasets that are included as samples, the package includes functions that import the full versions.

Please see fec16, a similar package that is on CRAN, for more documentation and examples.

Installation

fec12 is hosted on GitHub and call be installed by running the following:

devtools::install_github("baumer-lab/fec12")
library(fec12)

Datasets Included

Full Datasets

  • candidates: candidates registered with the FEC during the 2011-2012 election cycle
  • committees: committees registered with the FEC during the 2011-2012 election cycle
  • campaigns: the house/senate current campaigns
  • results_house: the house results of the 2012 general presidential election
  • results_senate: the senate results of the 2012 general presidential election
  • results_president: the final results of the 2012 general presidential election
  • pac: Political Action Committee (PAC) and party summary financial information

Sample Datasets (with 1000 random rows each)

  • individuals: individual contributions to candidates/committees during the 2012 general presidential election
  • contributions: candidates and their contributions from committees during the 2012 general election
  • expenditures: the operating expenditures
  • transactions: transactions between committees

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() ~ 250.6MB
  • read_all_contributions() ~ 12.2MB
  • read_all_expenditures() ~ 45.4MB
  • read_all_transactions() ~ 35.6MB

Examples

Data Wrangling

fec12 can be used to summarize data in order see how many candidates are running for elections (in all offices) for the two major parties:

library(dplyr)

data <- candidates %>%
  filter(cand_pty_affiliation %in% c("REP", "DEM")) %>%
  group_by(cand_pty_affiliation) %>%
  summarize(size = n())

data
#> # A tibble: 2 x 2
#>   cand_pty_affiliation  size
#>   <chr>                <int>
#> 1 DEM                   1180
#> 2 REP                   1472

Data Visualization

We can visualize the above data:

library(ggplot2)

ggplot(data, aes(x = cand_pty_affiliation, y = size, fill = cand_pty_affiliation)) +
  geom_col() +
  labs(
    title = "Number of Candidates Affiliated with the Two Major Parties",
    x = "Party", y = "Count", fill = "Candidate Party Affiliation"
  )

Contributors

About

FEC data from 2012

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages