Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/christopherkenny/congress
Access the Congress.gov API
https://github.com/christopherkenny/congress
Last synced: 12 days ago
JSON representation
Access the Congress.gov API
- Host: GitHub
- URL: https://github.com/christopherkenny/congress
- Owner: christopherkenny
- License: other
- Created: 2022-09-11T21:23:22.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-08T16:53:59.000Z (4 months ago)
- Last Synced: 2024-09-14T12:42:16.689Z (about 2 months ago)
- Language: R
- Homepage: http://christophertkenny.com/congress/
- Size: 5.24 MB
- Stars: 13
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = '#>',
fig.path = 'man/figures/README-',
out.width = '100%'
)
```# congress
[![CRAN status](https://www.r-pkg.org/badges/version/congress)](https://CRAN.R-project.org/package=congress)
[![congress status badge](https://christopherkenny.r-universe.dev/badges/congress)](https://christopherkenny.r-universe.dev/congress)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![R-CMD-check](https://github.com/christopherkenny/congress/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/christopherkenny/congress/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/christopherkenny/congress/branch/main/graph/badge.svg)](https://app.codecov.io/gh/christopherkenny/congress?branch=main)`congress` provides a *mostly* tidy interface to the Congress.gov API, available at .
It provides a simple R interface for downloading and working with actions, bills, nominations, and more from Congress.## Installation
You can install the stable version of `congress` from [CRAN](https://CRAN.R-project.org/package=congress) with:
``` r
install.packages('congress')
```You can install the development version of congress from [GitHub](https://github.com/) with:
``` r
# install.packages('devtools')
devtools::install_github('christopherkenny/congress')
```## Example
To get the most recent `nomination`s, we can use the `cong_nomination()` function. By default, it gets the most recent 20. We request here, the most recent 10.
```{r example}
library(congress)cong_nomination(limit = 10)
```You can request up to 250 results, using `limit`. Once a request has been made, you can request the next set by using the `offset` argument:
```{r}
cong_nomination(limit = 10, offset = 10)
```You can also request the next set using the `cong_request_next()` function:
```{r}
cong_nomination(limit = 10) |>
cong_request_next()
```## Supported Endpoints:
This package is designed for `v3` of the [Congress.gov API](https://github.com/LibraryOfCongress/api.congress.gov/). It currently supports the following endpoints:
- bills with `cong_bill()`
- amendments with `cong_amendment()`
- summaries with `cong_summaries()`
- congresses with `cong_congress()`
- members with `cong_member()`
- committees with `cong_committee()`
- committee reports with `cong_committee_report()`
- committee prints with `cong_committee_print()`
- committee meetings with `cong_committee_meeting()`
- Congressional Records with `cong_record()`
- Daily Congressional Records with `cong_daily_record()`
- Bound Congressional Records with `cong_bound_record()`
- House communications with `cong_house_communication()`
- Senate communications with `cong_senate_communication()`
- nominations with `cong_nomination()`
- treaties with `cong_treaty()`
- hearings with `cong_hearing()`## Authentication
To sign up for an API key, visit the [Congress.gov API](https://api.congress.gov/sign-up/) sign-up website.
Once you have your key, you can set it in your environment as `CONGRESS_KEY`.
You can:1. Add this directly to your `.Renviron` file with a line like so
```r
CONGRESS_KEY='yourkey'
```If doing this, I recommend using `usethis::edit_r_environ()` to ensure that you open the correct .Renviron file.
2. Set this in you current R session with `Sys.setenv(CONGRESS_KEY='yourkey')`.
3. Set this using the `congress::set_congress_key()` function. To save this for future sessions, run with `install = TRUE`.