RPublica

rOG-badge CRAN
Version Downloads R build
status codecov r-universe

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 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.

The package serves as a client library for the (currently) three ProPublica data journalism APIs:

Installation

RPublica is available on GitHub and can (soon) be installed from within R from your favorite CRAN mirror:

install.packages("RPublica")

And the latest development version, available here, can be installed directly using devtools:

# install.packages("devtools")
library("devtools")
install_github("rOpenGov/RPublica")

Alternatively, you can install RPublica using the r-universe:

# 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 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).

library("RPublica")
str(np_search("propublica"), max = 1)
str(np_org(142007220), max = 1)

Forensics API

The Forensics API 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.

library("RPublica")
g <- geos()

tibble::as_tibble(g)

Free the Files

The 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), andfiling` (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.

library("RPublica")
tibble::as_tibble(market())

m <- market("new-york")
s <- station("WEWS-TV")
str(committee())


rOpenGov/RPublica documentation built on Jan. 13, 2023, 8:47 p.m.