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

njoaguof

R-CMD-check

This is a cleaned-up version of the NJ OAG Use of Force database available from https://www.njoag.gov/force/.

Dataset Overview

Examples

Every incident has a unique form_id, and this field is used to link the subject incident_xxx and incident_subject_xxx tables to specific incidents:

library(njoaguof)
library(dplyr)
# Summarize video_type by agency_county
incident %>%
  select(form_id, agency_county) %>%
  right_join(incident_video_type, by = "form_id") %>%
  count(agency_county, video_type)
library(njoaguof)
library(dplyr)
# Summarize subject gender by officer gender
incident %>% 
  select(form_id, officer_gender) %>% 
  right_join(subject, by="form_id") %>%
  count(officer_gender, subject_gender=gender)

Notes

The raw data from the NJ OAG is available in table use_of_force_raw, which has one row for each use of force incident. Fields with multiple values are recorded as comma separated lists. For example:

use_of_force_raw %>% count(SubjectGender) %>% head(5)

These fields are broken out into new data tables in the following categories.

Subject Fields

Several fields contain one value for each subject. We presume that the order is preserved, so that we may create one row for each subject in the subject table.

use_of_force_raw %>% filter(FormID == 16301) %>%
  select(
    FormID,
    SubjectArrested,
    SubjectType,
    SubjectAge,
    SubjectRaceEthnicity,
    SubjectGender
  )

subject %>% filter(form_id == 16301)

Multi-value incident fields

Some fields contain multiple values which apply to the entire incident. For each such column, we create a separate table expressing this many-to-one relationship. For example, this row in the source data has three values for incident_type, and this results in three rows in the incident_type table.

library(tidyverse)
use_of_force_raw %>% filter(FormID == 16301) %>%
  select(IncidentType)
incident_type %>% filter(form_id == 16301)

Multi-value Incident-Subject Fields

Some fields contain multiple values which apply to individual subjects, but there is no reliable way to assign the values to subjects. For example, in this row of the raw data, there are two subjects and three values in the SubResist field. In this case, we create three rows in the incident_subject_resistance table, indicating the position of each item in the list with the index value.

use_of_force_raw %>% 
  filter(FormID == 19542) %>% 
  select(SubjectType,SubjectResistance)
incident_subject_resistance %>% filter(form_id == 19542)

Note that it is not clear in the source data if "Aggressive resistance" should be associated to the first subject or to the second subject.

All of the incident_subject_xxx data tables are of this form, with an index column included so the order information is not lost.

Officer name variants

In the raw data, there are two fields which identify the officer: officer_name (an ID field) and Officer_Name2 (a name field). A single officer_name ID can be associated different spellings in the Officer_Name2 field. When building the incident table, we ensure that every officer_name_id is associated with a single spelling of the officer name by choosing the most common form.

But all variants of the officer names appearing in the source data are preserved in the officer_name_variants table.

Installation

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

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


tor-gu/njoaguof documentation built on Dec. 31, 2024, 4:27 a.m.