MyNixOS website logo
Description

Data Package for the 2016 United States Federal Elections.

Easily analyze relational data from the United States 2016 federal election cycle as reported by the Federal Election Commission. This package contains data about candidates, committees, and a variety of different financial expenditures. Data is from <https://www.fec.gov/data/browse-data/?tab=bulk-data>.

fec16

Lifecycle:stable CRANstatus CRAN RStudio mirrordownloads R-CMD-check

fec16 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 2015-2016 election cycle. Additionally, for the datasets that are included as samples, the package includes functions that import the full versions.

Installation

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 package
library(fec16)

Datasets Included

Full Datasets

  • candidates: candidates registered with the FEC during the 2015-2016 election cycle
  • committees: committees registered with the FEC during the 2015-2016 election cycle
  • campaigns: the House/Senate current campaigns
  • results_house: the House results of the 2016 general election
  • results_senate: the Senate results of the 2016 general election
  • results_president: the final results of the 2016 general election
  • 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 2016 election cycle
  • contributions: candidates and their contributions from committees during the 2016 election cycle
  • 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() ~ 1.45GB
  • read_all_contributions() ~ 15.4MB
  • read_all_expenditures() ~ 52.1MB
  • read_all_transactions() ~ 79.2MB

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.

Examples

Data Wrangling

fec16 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 × 2
#>   cand_pty_affiliation  size
#>   <chr>                <int>
#> 1 DEM                   1270
#> 2 REP                   1495

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"
  )

See Also

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

Contributors

Metadata

Version

0.1.4

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows