- Notifications
You must be signed in to change notification settings - Fork4
baumer-lab/fec16
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
fec16 contains data from theFederal Election Commission(FEC) website pertaining to candidates,committees, results, contributions from committees and individuals, andother financialdata for the United States 2015-2016 electioncycle.Additionally, for the datasets that are included as samples, the packageincludes functions that import the full versions.
Get the latest released version from CRAN:
install.packages("fec16")Or the development version from GitHub:
# If you haven't installed the remotes package yet, do so:# install.packages("remotes")remotes::install_github("baumer-lab/fec16")
# Load packagelibrary(fec16)
candidates: candidates registered with the FEC during the 2015-2016election cyclecommittees: committees registered with the FEC during the 2015-2016election cyclecampaigns: the House/Senate current campaignsresults_house: the House results of the 2016 general electionresults_senate: the Senate results of the 2016 general electionresults_president: the final results of the 2016 general electionpac: Political Action Committee (PAC) and party summary financialinformationstates: geographical information about the 50 states
individuals: individual contributions to candidates/committeesduring the 2016 election cyclecontributions: candidates and their contributions from committeesduring the 2016 election cycleexpenditures: the operating expenditurestransactions: transactions between committees
The following functions retrieve the entire datasets for the sampledones listed above. The size of the raw file that is downloaded bycalling each function is given for reference. All functions have anargumentn_max which defaults to the entire dataset but the user canspecify the max length of the dataset to be loaded via this argument.
read_all_individuals()~ 1.45GBread_all_contributions()~ 15.4MBread_all_expenditures()~ 52.1MBread_all_transactions()~ 79.2MB
The headers of each table show the dataset name. The underlinedvariables areprimary keys while all the others areforeignkeys. The arrows show how the datasets are connected.
The diagram is built using thedm R package. The code can be found indata-raw/dm.R.
fec16 can be used to summarize data in order see how many candidatesare 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 × 2#> cand_pty_affiliation size#> <chr> <int>#> 1 DEM 1270#> 2 REP 1495
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" )
If you are interested in political data, check out the following relatedpackages:
About
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Languages
- R55.4%
- JavaScript44.6%


