MyNixOS website logo
Description

A 'GovInfo' API Wrapper.

Access data provided by the United States Government Publishing Office (GPO) 'GovInfo' API (<https://github.com/usgpo/api>).

govinfoR

govinfoR offers an easy way to access data provided by the United States Government Publishing Office (GPO) GovInfo API in R. It’s currently in early development, but functions for all GET endpoints are available. The API’s search endpoint, which as of this writing is in Public Preview, is outside the scope of this package at present.

Installation

You can install the stable version of govinfoR from CRAN with:

install.packages("govinfoR")

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

# install.packages("devtools")
devtools::install_github("blackerby/govinfoR")

Examples

This first example loads the package, sets the API key (gotten from the environment), and gets metadata about all 39 GovInfo collections.

library(govinfoR)

gpo_collections()
#> # A tibble: 39 × 4
#>    collection_code collection_name                  package_count granule_count
#>    <chr>           <chr>                                    <int>         <int>
#>  1 BILLS           Congressional Bills                     260096            NA
#>  2 BILLSTATUS      Congressional Bill Status               147507            NA
#>  3 BUDGET          United States Budget                       338          6759
#>  4 CCAL            Congressional Calendars                   5516         88218
#>  5 CDIR            Congressional Directory                    237         15024
#>  6 CDOC            Congressional Documents                  24174          9580
#>  7 CFR             Code of Federal Regulations               6090       7155023
#>  8 CHRG            Congressional Hearings                   38974           285
#>  9 CMR             Congressionally Mandated Reports           244            NA
#> 10 COMPS           Statutes Compilations                     2449            NA
#> # ℹ 29 more rows

The following example demonstrates getting all records in the BILLS collection since midnight yesterday.

The package provides three simple helpers to make it easier to specify dates as arguments to functions (yesterday(), today(), and tomorrow())

gpo_collections(collection = "BILLS", start_date = "2024-02-17T00:00:00Z")
#> # A tibble: 29 × 7
#>    package_id          last_modified       package_link doc_class title congress
#>    <chr>               <dttm>              <chr>        <fct>     <chr>    <int>
#>  1 BILLS-118hr7278ih   2024-02-17 05:46:41 https://api… hr        Hous…      118
#>  2 BILLS-118hr7275ih   2024-02-17 05:46:41 https://api… hr        Comp…      118
#>  3 BILLS-118hr7288ih   2024-02-17 05:46:31 https://api… hr        Arme…      118
#>  4 BILLS-118hr7287ih   2024-02-17 05:46:31 https://api… hr        Coun…      118
#>  5 BILLS-118hr7286ih   2024-02-17 05:46:31 https://api… hr        Gene…      118
#>  6 BILLS-118hr7277ih   2024-02-17 05:46:26 https://api… hr        Halt…      118
#>  7 BILLS-118hr7276ih   2024-02-17 05:46:25 https://api… hr        Tele…      118
#>  8 BILLS-118hr7274ih   2024-02-17 05:46:25 https://api… hr        Conn…      118
#>  9 BILLS-118hr6544rh   2024-02-17 05:44:35 https://api… hr        Atom…      118
#> 10 BILLS-118hres1021ih 2024-02-17 05:44:30 https://api… hres      Prov…      118
#> # ℹ 19 more rows
#> # ℹ 1 more variable: date_issued <date>

Examples of the use of other package functions are in the documentation.

Metadata

Version

0.0.3

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • 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-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