knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) tibble:::op.tibble options(width = 90, tibble.print_min = 5, tibble.print_max = 5) library(ppcong)
A simple interface for interacting with ProPublica's Congress API, which provides data about current and former members of both chambers of the U.S. Congress.
You can install the released version of ppcong from CRAN with:
install.packages("ppcong")
And the development version from GitHub with:
# install.packages("remotes") remotes::install_github("mkearney/ppcong")
Get "house" data from the "116"th Congress:
## get and preview house data from 116th congress h116 <- ppc_members(congress = "116", chamber = "house") h116
Get "senate" data from the "110"th Congress:
## get and preview senate data from 110th congress s110 <- ppc_members(congress = "110", chamber = "senate") s110
Get statements released by members of Congress by date
## get and preview statements from congress on a given day sts <- ppc_statements("2017-05-08") sts
Get statements released by members of Congress by date
## get and preview congressional votes information vts <- ppc_votes("both") vts
Search for bills in Congress
## get and preview congressional bills information hc_bls <- ppc_bills("health care") hc_bls
Get lists of congressional committees
## get and preview committees information for Senators in 115th Congress cmt <- ppc_committees("115", chamber = "senate") cmt
Use of the ProPublica API requires a valid key, which you can obtain by completing the form found at the following URL: https://www.propublica.org/datastore/api/propublica-congress-api
Once you've obtained an API key, you can either include it in every request, e.g.,
## include API key in request s116 <- ppc_members(116, "senate", api_key = "as9d78f6aayd9fy2fq378a9ds876fsas89d7f")
Or for the duration of any given session, you can set the API key once via the
ppc_api_key()
function
## set as environment variable for the remainder of current session ppc_api_key("as9d78f6aayd9fy2fq378a9ds876fsas89d7f")
If you'd like to set the API key and store it for use in future sessions, use
set_renv = TRUE
## append as environment variable in user's home .Renviron file ppc_api_key("as9d78f6aayd9fy2fq378a9ds876fsas89d7f", set_renv = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.