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

njoagleod

R-CMD-check

This is a cleaned-up version of the NJ OAG Law Enforcement Officer Diversity database available from https://www.njoag.gov/policerecruiting/

Dataset Overview

This dataset contains two tables.

Currently 2021 is the only year represented.

Examples

The agency table looks like this:

library(njoagleod)
library(tidyverse)
agency

The columns year, agency_county and agency_name form the primary key.

The officer table looks like this.

officer

The columns year, agency_county and agency_name act as a foreign key to the agency table.

The agency_name and agency_county columns are consistent with the columns of the same name in the associated njoaguof package so that they may be easily used together.

For example, here are the agencies with the highest number of use-of-force incidents per officer.

officer %>% 
  group_by(year, agency_county, agency_name) %>%
  summarize(officer_count = n(), .groups = "drop") %>%
  left_join(njoaguof::incident, by=c("agency_county", "agency_name")) %>%
  filter(lubridate::year(incident_date_1)==year) %>%
  group_by(year, agency_county, agency_name, officer_count) %>%
  summarize(incident_count = n(), .groups="drop") %>%
  mutate(incidents_per_officer = incident_count / officer_count) %>%
  select(-agency_county) %>%
  arrange(desc(incidents_per_officer))

Notes

Duplicates entries removed

In the source data, The Delaware River and Bay Authority Police Department and its officers appear twice, once associated to Salem County and once associated to Cape May County.

In this package, we have removed the duplicate entries and assigned the county to NA. As a result, the source data has 30617 officers across 530 agencies, while this package contains 30565 officers and 529 agencies.

Chester PD agency_type changed to "Multiple Municipality"

In the source data, Chester PD is listed as a municipal agency, but it is a multiple municipality agency. In this package, the agency type has been changed to "Multiple Municipality".

Source: Former site of the Chester Borough Police

Installation

You can install the latest version of njoaguof from GitHub with:

# install.packages("devtools")
devtools::install_github("tor-gu/njoagleod")


tor-gu/njoagleod documentation built on Jan. 9, 2023, 5:41 a.m.