knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

phillydaodata

CRAN status Travis build status AppVeyor build status Coverage status

phillydaodata is a collection of simpler helper functions that make it easy to work with the publicly available data that the Philadelphia District Attorney's Office makes available on their Public Data Dashboard. This package is not an official product of the Philadelphia District Attorney's Office - it is merely a way to handle their already public and freely available data.

If you are going to be using the data, please read the Limitations page of the Philadelphia District Attorney's Office closely as that discusses the caveats of the data. You should also read the Definitions page which explains a lot of the terms used in the data and some of the assumptions that the District Attorney's Office team took when it came to the data (e.g. how the supervision time is estimated).

Installation

You can install the released version of phillydaodata from CRAN with:

install.packages("phillydaodata")

Example

Each function in this package follows the same pattern where the function name (e.g. get_arrests()) determines which data you will receive and the parameter geography determines which geographic unit the data will be in. The choices for this parameter are "citywide", "police_district", "zip_code", and "census_tract". For "census_tract" the data will be weekly; for the other geographies, the data will be daily.^[According to the District Attorney's Office's website this is because the Census tract file gets very large so they aggregate it weekly to save space.]

If you don't include a geography parameter, it'll default to citywide.

library(phillydaodata)

data <- get_summary_charges()
dim(data)
head(data)
tail(data)

Selecting a geography returns that data not in the geographic units you select, rather than for all of Philadelphia. It also adds a column indicating, for each row, what geography that row is for.

data <- get_summary_charges(geography = "police_district")
dim(data)
head(data)
tail(data)


jacobkap/phillyDAO documentation built on Jan. 1, 2021, 4:26 a.m.