MyNixOS website logo
Description

Access the Congress.gov API.

Download and read data on United States congressional proceedings. Data is read from the Library of Congress's Congress.gov Application Programming Interface (<https://github.com/LibraryOfCongress/api.congress.gov/>). Functions exist for all version 3 endpoints, including for bills, amendments, congresses, summaries, members, reports, communications, nominations, and treaties.

congress

CRANstatus congress statusbadge Lifecycle:stable R-CMD-check Codecov testcoverage

congress provides a mostly tidy interface to the Congress.gov API, available at https://github.com/LibraryOfCongress/api.congress.gov/. 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 with:

install.packages('congress')

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

# install.packages('devtools')
devtools::install_github('christopherkenny/congress')

Example

To get the most recent nominations, we can use the cong_nomination() function. By default, it gets the most recent 20. We request here, the most 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, using limit. Once a request has been made, you can request the next set by using the offset 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 the cong_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 for v3 of the Congress.gov API. 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 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
CONGRESS_KEY='yourkey'

If doing this, I recommend using usethis::edit_r_environ() to ensure that you open the correct .Renviron file.

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

  2. Set this using the congress::set_congress_key() function. To save this for future sessions, run with install = TRUE.

Metadata

Version

0.1.0

License

Unknown

Platforms (76)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows