- Notifications
You must be signed in to change notification settings - Fork1
Access the Congress.gov API
License
Unknown, MIT licenses found
Licenses found
christopherkenny/congress
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
congress provides amostly tidy interface to the Congress.gov API,available athttps://github.com/LibraryOfCongress/api.congress.gov/.It provides a simple R interface for downloading and working withactions, bills, nominations, and more from Congress.
You can install the stable version ofcongress fromCRAN with:
install.packages('congress')You can install the development version of congress fromGitHub with:
# install.packages('devtools')devtools::install_github('christopherkenny/congress')
To get the most recentnominations, we can use thecong_nomination()function. By default, it gets the most recent 20. We request here, themost recent 10.
library(congress)cong_nomination(limit=10)#> # A tibble: 10 × 13#> citation congress description latest_action_action…¹ latest_action_text#> <chr> <chr> <chr> <date> <chr>#> 1 PN1293 118 Robin Michelle M… 2024-06-20 Cloture motion pr…#> 2 PN830 118 Patricia L. Lee,… 2024-06-20 Cloture motion pr…#> 3 PN1355 118 Charles J. Willo… 2024-06-20 Cloture motion pr…#> 4 PN1343 118 Stephanie Sander… 2024-06-20 Confirmed by the …#> 5 PN1851 118 <NA> 2024-06-20 Received in the S…#> 6 PN1847 118 <NA> 2024-06-20 Received in the S…#> 7 PN1850 118 <NA> 2024-06-20 Received in the S…#> 8 PN1842 118 <NA> 2024-06-20 Received in the S…#> 9 PN1849 118 <NA> 2024-06-20 Received in the S…#> 10 PN1848 118 <NA> 2024-06-20 Received in the S…#> # ℹ abbreviated name: ¹latest_action_action_date#> # ℹ 8 more variables: nomination_type_is_civilian <chr>, number <chr>,#> # organization <chr>, part_number <chr>, received_date <date>,#> # update_date <dttm>, url <chr>, nomination_type_is_military <chr>
You can request up to 250 results, usinglimit. Once a request hasbeen made, you can request the next set by using theoffset argument:
cong_nomination(limit=10,offset=10)#> # A tibble: 10 × 13#> citation congress latest_action_action_date latest_action_text#> <chr> <chr> <date> <chr>#> 1 PN1847 118 2024-06-20 Received in the Senate and refer…#> 2 PN1805 118 2024-06-20 Committee on the Judiciary. Hear…#> 3 PN1807 118 2024-06-20 Committee on the Judiciary. Hear…#> 4 PN1842 118 2024-06-20 Received in the Senate and refer…#> 5 PN1808 118 2024-06-20 Committee on the Judiciary. Hear…#> 6 PN1850 118 2024-06-20 Received in the Senate and refer…#> 7 PN1806 118 2024-06-20 Committee on the Judiciary. Hear…#> 8 PN1461 118 2024-06-20 Cloture invoked in Senate by Yea…#> 9 PN1849 118 2024-06-20 Received in the Senate and refer…#> 10 PN1851 118 2024-06-20 Received in the Senate and refer…#> # ℹ 9 more variables: nomination_type_is_military <chr>, number <chr>,#> # organization <chr>, part_number <chr>, received_date <date>,#> # update_date <dttm>, url <chr>, description <chr>,#> # nomination_type_is_civilian <chr>
You can also request the next set using thecong_request_next()function:
cong_nomination(limit=10)|> cong_request_next()#> # A tibble: 20 × 13#> citation congress description latest_action_action…¹ latest_action_text#> <chr> <chr> <chr> <date> <chr>#> 1 PN1293 118 Robin Michelle M… 2024-06-20 Cloture motion pr…#> 2 PN830 118 Patricia L. Lee,… 2024-06-20 Cloture motion pr…#> 3 PN1355 118 Charles J. Willo… 2024-06-20 Cloture motion pr…#> 4 PN1343 118 Stephanie Sander… 2024-06-20 Confirmed by the …#> 5 PN1851 118 <NA> 2024-06-20 Received in the S…#> 6 PN1847 118 <NA> 2024-06-20 Received in the S…#> 7 PN1850 118 <NA> 2024-06-20 Received in the S…#> 8 PN1842 118 <NA> 2024-06-20 Received in the S…#> 9 PN1849 118 <NA> 2024-06-20 Received in the S…#> 10 PN1848 118 <NA> 2024-06-20 Received in the S…#> 11 PN1847 118 <NA> 2024-06-20 Received in the S…#> 12 PN1805 118 Karla M. Campbel… 2024-06-20 Committee on the …#> 13 PN1807 118 Mary Kay Lanthie… 2024-06-20 Committee on the …#> 14 PN1842 118 <NA> 2024-06-20 Received in the S…#> 15 PN1808 118 Julia M. Lipez, … 2024-06-20 Committee on the …#> 16 PN1850 118 <NA> 2024-06-20 Received in the S…#> 17 PN1806 118 Catherine Henry,… 2024-06-20 Committee on the …#> 18 PN1461 118 Nancy L. Maldona… 2024-06-20 Cloture invoked i…#> 19 PN1849 118 <NA> 2024-06-20 Received in the S…#> 20 PN1851 118 <NA> 2024-06-20 Received in the S…#> # ℹ abbreviated name: ¹latest_action_action_date#> # ℹ 8 more variables: nomination_type_is_civilian <chr>, number <chr>,#> # organization <chr>, part_number <chr>, received_date <date>,#> # update_date <dttm>, url <chr>, nomination_type_is_military <chr>
This package is designed forv3 of theCongress.govAPI. Itcurrently 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()
To sign up for an API key, visit theCongress.govAPI sign-up website.
Once you have your key, you can set it in your environment asCONGRESS_KEY. You can:
- Add this directly to your
.Renvironfile with a line like so
CONGRESS_KEY='yourkey'
If doing this, I recommend usingusethis::edit_r_environ() to ensurethat you open the correct .Renviron file.
Set this in you current R session with
Sys.setenv(CONGRESS_KEY='yourkey').Set this using the
congress::set_congress_key()function. To savethis for future sessions, run withinstall = TRUE.
About
Access the Congress.gov API
Resources
License
Unknown, MIT licenses found
Licenses found
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
