Skip to content

R scripts to create, analyze, and visualize cosponsorship networks in Congress

Notifications You must be signed in to change notification settings

blakemoya/congressional_networks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Congressional Social Networks in R

Using data from ProPublica's Bulk Data on Bills and an API key, these scripts generate and visualize cosponsor relationships between legislators.

Getting Started

Prerequisites

  • httr
  • jsonlite
  • igraph
  • ggraph

Usage

Downloads

Clone this repo with

git clone https://github.com/blakemoya/congressional_networks

Use this link to download a zip file containing data on all the bills introduced by a Congress in some particular year. The file will be named after that Congress's number (i.e. the 115th Congress will give you 115.zip) Extract the file/files of interest into the congressional_networks directory.

Configuration

Use this link to request an API key. Save the key emailed to you in a .txt file called api_key.txt followed by an empty line (i.e. copy and paste in the key, then press enter and save). Copy this file into the congressional_networks directory.

Then, in line 5 of both gen_graphfiles.R and gen_plots.R set the variable congress to the congress you are interested in. For instance, if I downloaded and extracted 115.zip:

congress = 115

Once this is done, you can run gen_graphfiles.R (in RStudio, Ctrl + A, Ctrl + Enter) and then gen_plots.R. gen_plots.R takes a lot of time to produce house graphs, but the results are well worth it.

Results

The 116th House

The 116th Senate

About

R scripts to create, analyze, and visualize cosponsorship networks in Congress

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages