-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
135 lines (98 loc) · 3.57 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
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)
```
# ppcong <img src="man/figures/logo.png" width="160px" align="right" />
<!-- badges: start -->
[![Travis build status](https://travis-ci.org/mkearney/ppcong.svg?branch=master)](https://travis-ci.org/mkearney/ppcong)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/mkearney/ppcong?branch=master&svg=true)](https://ci.appveyor.com/project/mkearney/ppcong)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![CRAN status](https://www.r-pkg.org/badges/version/ppcong)](https://CRAN.R-project.org/package=ppcong)
[![Codecov test coverage](https://codecov.io/gh/mkearney/ppcong/branch/master/graph/badge.svg)](https://codecov.io/gh/mkearney/ppcong?branch=master)
<!-- badges: end -->
A simple interface for interacting with [ProPublica's Congress API](https://projects.propublica.org/api-docs/congress-api/), which
provides data about current and former members of both chambers of the U.S.
Congress.
## Installation
You can install the released version of ppcong from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("ppcong")
```
And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("remotes")
remotes::install_github("mkearney/ppcong")
```
## Members
Get "house" data from the "116"th Congress:
```{r}
## get and preview house data from 116th congress
h116 <- ppc_members(congress = "116", chamber = "house")
h116
```
Get "senate" data from the "110"th Congress:
```{r}
## get and preview senate data from 110th congress
s110 <- ppc_members(congress = "110", chamber = "senate")
s110
```
## Statements
Get statements released by members of Congress by date
```{r}
## get and preview statements from congress on a given day
sts <- ppc_statements("2017-05-08")
sts
```
## Votes
Get statements released by members of Congress by date
```{r}
## get and preview congressional votes information
vts <- ppc_votes("both")
vts
```
## Bills
Search for bills in Congress
```{r}
## get and preview congressional bills information
hc_bls <- ppc_bills("health care")
hc_bls
```
## Committees
Get lists of congressional committees
```{r}
## get and preview committees information for Senators in 115th Congress
cmt <- ppc_committees("115", chamber = "senate")
cmt
```
## API Key
Use of the [ProPublica API](https://projects.propublica.org/api-docs/congress-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.,
``` r
## 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
``` r
## 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`
``` r
## append as environment variable in user's home .Renviron file
ppc_api_key("as9d78f6aayd9fy2fq378a9ds876fsas89d7f", set_renv = TRUE)
```