Skip to content

miriamasagold/congressapi

Repository files navigation

congressapi

R-CMD-check Lifecycle: experimental Codecov test coverage

congressapi provides an extremely lightweight wrapper, facilitating seamless data retrieval from the official Congress API via a single function, get_congress().

Installation

You can install the development version of congressapi from GitHub with:

# install.packages("devtools")
devtools::install_github("miriamasagold/congressapi")

Retrieving data

Data may be retrieved from one of eleven base endpoints:

  • bill
  • amendment
  • summaries
  • congress
  • member
  • committee
  • committee-report
  • congressional-record
  • house-communication
  • nomination
  • treaty

All the user needs to do is specify the endpoint, along with any additional specifications desired:

library(congressapi)
# Retrieves all house bills from the 117th Congress
bill <- 
    dplyr::tibble(
      congressapi::get_congress("bill/117/hr")
      )

head(bill)
#> # A tibble: 6 × 11
#>   congress number originChamber originChamberCode title         type  updateDate
#>      <int> <chr>  <chr>         <chr>             <chr>         <chr> <chr>     
#> 1      117 897    House         H                 Agua Calient… HR    2023-03-09
#> 2      117 7939   House         H                 Veterans Aut… HR    2023-08-02
#> 3      117 680    House         H                 For the reli… HR    2023-03-08
#> 4      117 1917   House         H                 Hazard Eligi… HR    2023-03-09
#> 5      117 1154   House         H                 Great Dismal… HR    2023-03-09
#> 6      117 1082   House         H                 Sami's Law    HR    2023-08-25
#> # ℹ 4 more variables: updateDateIncludingText <chr>, url <chr>,
#> #   latestAction_actionDate <chr>, latestAction_text <chr>

Visit https://miriamasagold.github.io/congressapi/ to read full package documentation. If you find a bug or would like to see a new functionality, please submit an issue.

Note

This project is neither endorsed nor sponsored by the United States Congress.