Skip to content

Commit

Permalink
Version 1.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tor-gu committed Dec 28, 2024
1 parent 2f381a0 commit 0627c46
Show file tree
Hide file tree
Showing 30 changed files with 688 additions and 609 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: njoaguof
Title: NJ OAG Use of Force data package
Version: 1.15.0
Version: 1.16.0
Authors@R:
person("Tor", "Gunston", , "tor.gunston@protonmail.com", role = c("aut", "cre"))
Description: This is cleaned-up version of the NJ OAG Use of Force database
Expand All @@ -10,7 +10,7 @@ URL: https://github.com/tor-gu/njoaguof
BugReports: https://github.com/tor-gu/njoaguof/issues
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Imports:
magrittr
Suggests:
Expand Down
18 changes: 18 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# njoaguof 1.16.0
* Update to most recent dataset from NJ OAG:
"NJOAG Use of Force Data Dashboard 10-01-20 to 09-30-24.dta"

* Change to `incident`:
- New variable `other_officer_involved`
- New variable `officer_in_uniform`

* Change to `subject`:
- New variable `injured`
- New variable `injured_prior`

* Change to `incident_contact_origin`:
- New level `Officer Dispatched`

* Change to `incident_planned_contact`:
- New level `No Knock Warrant`

# njoaguof 1.15.0
* Update to most recent dataset from NJ OAG:
"NJOAG Use of Force Data Dashboard 10-01-20 to 05-31-23.dta"
Expand Down
24 changes: 12 additions & 12 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,21 @@ incident %>%

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:
```{r}
use_of_force_raw %>% count(SubjectsGender) %>% head(5)
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.
```{r}
use_of_force_raw %>% filter(form_id == 16301) %>%
use_of_force_raw %>% filter(FormID == 16301) %>%
select(
form_id,
SubjectsArrested,
subject_type,
SubectsAge,
SubjectRace,
SubjectsGender
FormID,
SubjectArrested,
SubjectType,
SubjectAge,
SubjectRaceEthnicity,
SubjectGender
)
subject %>% filter(form_id == 16301)
Expand All @@ -98,8 +98,8 @@ subject %>% filter(form_id == 16301)
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.
```{r}
library(tidyverse)
use_of_force_raw %>% filter(form_id == 16301) %>%
select(incident_type)
use_of_force_raw %>% filter(FormID == 16301) %>%
select(IncidentType)
incident_type %>% filter(form_id == 16301)
```

Expand All @@ -108,8 +108,8 @@ incident_type %>% filter(form_id == 16301)
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.
```{r}
use_of_force_raw %>%
filter(form_id == 19542) %>%
select(subject_type,SubResist)
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.
Expand Down
135 changes: 67 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,20 @@ incident %>%
select(form_id, agency_county) %>%
right_join(incident_video_type, by = "form_id") %>%
count(agency_county, video_type)
#> # A tibble: 179 × 3
#> # A tibble: 187 × 3
#> agency_county video_type n
#> <fct> <fct> <int>
#> 1 Atlantic County Body Worn 1026
#> 2 Atlantic County CED Camera 7
#> 3 Atlantic County Cell Phone 8
#> 4 Atlantic County Commercial Building 57
#> 5 Atlantic County Motor Vehicle 235
#> 6 Atlantic County Residential/Home 2
#> 7 Atlantic County Station House 55
#> 1 Atlantic County Body Worn 2269
#> 2 Atlantic County CED Camera 14
#> 3 Atlantic County Cell Phone 11
#> 4 Atlantic County Commercial Building 100
#> 5 Atlantic County Motor Vehicle 322
#> 6 Atlantic County Residential/Home 13
#> 7 Atlantic County Station House 97
#> 8 Atlantic County Other 31
#> 9 Bergen County Body Worn 1295
#> 10 Bergen County CED Camera 61
#> # ℹ 169 more rows
#> 9 Bergen County Body Worn 2855
#> 10 Bergen County CED Camera 72
#> # ℹ 177 more rows
```

``` r
Expand All @@ -83,27 +83,25 @@ incident %>%
select(form_id, officer_gender) %>%
right_join(subject, by="form_id") %>%
count(officer_gender, subject_gender=gender)
#> # A tibble: 18 × 3
#> officer_gender subject_gender n
#> <fct> <fct> <int>
#> 1 Male Male 26177
#> 2 Male Female 7109
#> 3 Male Gender Non-Conforming/X 48
#> 4 Male <NA> 254
#> 5 Female Male 1274
#> 6 Female Female 779
#> 7 Female Gender Non-Conforming/X 4
#> 8 Female <NA> 11
#> 9 Gender Non-Conforming/X Male 17
#> 10 Gender Non-Conforming/X Female 8
#> 11 Gender Non-Conforming/X Gender Non-Conforming/X 2
#> 12 Other Male 3075
#> 13 Other Female 811
#> 14 Other Gender Non-Conforming/X 4
#> 15 Other <NA> 48
#> 16 <NA> Male 634
#> 17 <NA> Female 172
#> 18 <NA> <NA> 48
#> # A tibble: 16 × 3
#> officer_gender subject_gender n
#> <fct> <fct> <int>
#> 1 Male Male 19940
#> 2 Male Female 5313
#> 3 Male Non-Binary/X 36
#> 4 Male <NA> 874
#> 5 Female Male 1139
#> 6 Female Female 694
#> 7 Female Non-Binary/X 2
#> 8 Female <NA> 76
#> 9 Other Male 33845
#> 10 Other Female 9740
#> 11 Other Non-Binary/X 42
#> 12 Other <NA> 1305
#> 13 <NA> Male 27
#> 14 <NA> Female 9
#> 15 <NA> Non-Binary/X 4
#> 16 <NA> <NA> 7
```

## Notes
Expand All @@ -113,15 +111,15 @@ which has one row for each use of force incident. Fields with multiple
values are recorded as comma separated lists. For example:

``` r
use_of_force_raw %>% count(SubjectsGender) %>% head(5)
use_of_force_raw %>% count(SubjectGender) %>% head(5)
#> # A tibble: 5 × 2
#> SubjectsGender n
#> <chr> <int>
#> 1 "" 1
#> 2 "Female," 8517
#> 3 "Female,Female" 73
#> 4 "Female,Female,Female," 4
#> 5 "Female,Female,Female,Female" 4
#> SubjectGender n
#> <chr> <int>
#> 1 Female 15359
#> 2 Female, Female 114
#> 3 Female, Female, Female 12
#> 4 Female, Female, Female, Female 4
#> 5 Female, Female, Female, Female, Female 1
```

These fields are broken out into new data tables in the following
Expand All @@ -134,26 +132,27 @@ order is preserved, so that we may create one row for each subject in
the `subject` table.

``` r
use_of_force_raw %>% filter(form_id == 16301) %>%
use_of_force_raw %>% filter(FormID == 16301) %>%
select(
form_id,
SubjectsArrested,
subject_type,
SubectsAge,
SubjectRace,
SubjectsGender
FormID,
SubjectArrested,
SubjectType,
SubjectAge,
SubjectRaceEthnicity,
SubjectGender
)
#> # A tibble: 1 × 6
#> form_id SubjectsArrested subject_type SubectsAge SubjectRace SubjectsGender
#> <dbl> <chr> <chr> <chr> <chr> <chr>
#> 1 16301 True,False Person,Person 26,23 Hispanic,Bla… Male,Female
#> FormID SubjectArrested SubjectType SubjectAge SubjectRaceEthnicity
#> <dbl> <chr> <chr> <chr> <chr>
#> 1 16301 False, True Person, Person 23, 26 Black or African American, H…
#> # ℹ 1 more variable: SubjectGender <chr>

subject %>% filter(form_id == 16301)
#> # A tibble: 2 × 8
#> form_id index arrested type age juvenile race gender
#> <dbl> <int> <lgl> <fct> <int> <lgl> <fct> <fct>
#> 1 16301 1 TRUE Person 26 FALSE Hispanic Male
#> 2 16301 2 FALSE Person 23 FALSE Black Female
#> # A tibble: 2 × 10
#> form_id index arrested type age juvenile race gender injured injured_prior
#> <dbl> <int> <lgl> <fct> <int> <lgl> <fct> <fct> <lgl> <lgl>
#> 1 16301 1 FALSE Pers… 23 FALSE Black Female FALSE FALSE
#> 2 16301 2 NA <NA> 26 FALSE <NA> <NA> TRUE FALSE
```

#### Multi-value incident fields
Expand All @@ -166,10 +165,10 @@ three values for `incident_type`, and this results in three rows in the

``` r
library(tidyverse)
use_of_force_raw %>% filter(form_id == 16301) %>%
select(incident_type)
use_of_force_raw %>% filter(FormID == 16301) %>%
select(IncidentType)
#> # A tibble: 1 × 1
#> incident_type
#> IncidentType
#> <chr>
#> 1 Potential Mental Health Incident, Suspicious person, Disturbance (drinking, f…
incident_type %>% filter(form_id == 16301)
Expand All @@ -192,19 +191,19 @@ item in the list with the `index` value.

``` r
use_of_force_raw %>%
filter(form_id == 19542) %>%
select(subject_type,SubResist)
filter(FormID == 19542) %>%
select(SubjectType,SubjectResistance)
#> # A tibble: 1 × 2
#> subject_type SubResist
#> <chr> <chr>
#> 1 Person,Person Verbal,Aggressive resistance(attempt to attack or harm),Verbal,
#> SubjectType SubjectResistance
#> <chr> <chr>
#> 1 Person, Person Verbal, Verbal, Aggressive resistance (attempt to attack or ha…
incident_subject_resistance %>% filter(form_id == 19542)
#> # A tibble: 3 × 3
#> form_id index subject_resistance
#> <dbl> <int> <fct>
#> 1 19542 1 Verbal
#> 2 19542 2 Aggressive resistance(attempt to attack or harm)
#> 3 19542 3 Verbal
#> form_id index subject_resistance
#> <dbl> <int> <fct>
#> 1 19542 1 Verbal
#> 2 19542 2 Verbal
#> 3 19542 3 Aggressive resistance (attempt to attack or harm)
```

Note that it is not clear in the source data if “Aggressive resistance”
Expand Down
Loading

0 comments on commit 0627c46

Please sign in to comment.