-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME.Rmd
145 lines (110 loc) · 4.53 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
135
136
137
138
139
140
141
142
143
144
145
---
output: github_document
editor_options:
markdown:
wrap: 80
---
# RPublica <a href='https://ropengov.github.io/RPublica/'><img src="man/figures/logo.png" align="right" height="139"/></a>
<!-- badges: start -->
[](http://ropengov.org/)
[](https://CRAN.R-project.org/package=RPublica)
 [](https://github.com/rOpenGov/RPublica/actions)
[](https://app.codecov.io/gh/rOpenGov/RPublica)
[](https://ropengov.r-universe.dev/)
<!-- badges: end -->
```{r, include = FALSE}
knitr::opts_knit$set(
progress = TRUE
)
knitr::opts_chunk$set(
collapse = TRUE,
tidy = "styler",
comment = "#>",
warning = FALSE,
message = FALSE,
dev = "ragg_png",
dpi = 300,
out.width = "100%"
)
```
## ProPublica API Client
The package is released under GPL-2 as part of the
[rOpenGov](http://ropengov.github.io/) project. Licenses for the data depend on
the particular API, but access to that data (regardless of license) through the
APIs is allowed under [ProPublica's Data Terms of
Use](https://www.propublica.org/datastore/terms/).
The package serves as a client library for the (currently) three
[ProPublica](https://www.propublica.org/) data journalism APIs:
- [Nonprofit Explorer](https://projects.propublica.org/nonprofits/api), which
provides access to IRS Form 990 data on for every organization required to
file a Form 990 (i.e., those claiming tax exempt status). These data are in
the public domain.
- [Forensics](https://projects.propublica.org/forensics/api.html), which provides
state- and county-level data about coroner and medical examiner systems.
These data are released under a modified Creative Commons license.
- [Free the Files](https://projects.propublica.org/free-the-files/api), which
provides access to political television spending data based on FCC filings
in 33 swing markets. These data are released under a modified Creative
Commons license.
## Installation
**RPublica** is [available on GitHub](https://github.com/rOpenGov/RPublica) and
can (soon) be installed from within R from your favorite CRAN mirror:
```r
install.packages("RPublica")
```
And the latest development version, available here, can be installed directly
using [devtools](https://CRAN.R-project.org/package=devtools):
```r
# install.packages("devtools")
library("devtools")
install_github("rOpenGov/RPublica")
```
Alternatively, you can install `RPublica` using the
[r-universe](https://ropengov.r-universe.dev):
``` r
# Enable this universe
options(repos = c(
ropengov = "https://ropengov.r-universe.dev",
CRAN = "https://cloud.r-project.org"
))
install.packages("RPublica")
```
## Using the package
### Nonprofit Explorer
The [Nonprofit Explorer API](https://projects.propublica.org/nonprofits/api)
functionality includes two functions: `npsearch`, to retrieve subsets of
available organizations, and `np_org` to retrieve detailed information about a
given organization including a direct link to the complete Form 990 for that
organization (as a PDF).
```{r eval=TRUE, echo=TRUE}
library("RPublica")
str(np_search("propublica"), max = 1)
str(np_org(142007220), max = 1)
```
### Forensics API
The [Forensics API](https://projects.propublica.org/forensics/api.html) functionality
includes two functions: `geos`, to return data for a specific state, and
`systems`, to return detailed data and statistics about specified medical
examiner (or coroner) system.
```{r eval=TRUE, echo=TRUE}
library("RPublica")
g <- geos()
tibble::as_tibble(g)
```
### Free the Files
The [Free the Files API](https://projects.propublica.org/free-the-files/api)
functionality includes four functions: `market` (for retrieving available
markets, or a specific market), `station` (for retrieving station-specific
data`,`committee`(for retrieving sponsoring committees, or a specific such committee), and`filing\`
(for retrieving details of a specific filing). A codebook describing the values
returned by each function is available at:
<https://projects.propublica.org/free-the-files/api>.
```{r eval=TRUE, echo=TRUE}
library("RPublica")
tibble::as_tibble(market())
m <- market("new-york")
s <- station("WEWS-TV")
str(committee())
```