Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Access the Congress.gov API

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
NotificationsYou must be signed in to change notification settings

christopherkenny/congress

Repository files navigation

CRAN statuscongress status badgeLifecycle: stableR-CMD-checkCodecov test coverage

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.

Installation

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

Example

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>

Supported Endpoints:

This package is designed forv3 of theCongress.govAPI. Itcurrently supports the following endpoints:

  • bills withcong_bill()
  • amendments withcong_amendment()
  • summaries withcong_summaries()
  • congresses withcong_congress()
  • members withcong_member()
  • committees withcong_committee()
  • committee reports withcong_committee_report()
  • committee prints withcong_committee_print()
  • committee meetings withcong_committee_meeting()
  • Congressional Records withcong_record()
  • Daily Congressional Records withcong_daily_record()
  • Bound Congressional Records withcong_bound_record()
  • House communications withcong_house_communication()
  • Senate communications withcong_senate_communication()
  • nominations withcong_nomination()
  • treaties withcong_treaty()
  • hearings withcong_hearing()

Authentication

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:

  1. Add this directly to your.Renviron file 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.

  1. Set this in you current R session withSys.setenv(CONGRESS_KEY='yourkey').

  2. Set this using thecongress::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

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp