Fetch HIB (Harassment, Intimidation, Bullying) Investigations
Source:R/fetch_spr.R
fetch_hib_investigations.RdDownloads the HIBInvestigations sheet from the NJ DOE School
Performance Reports. The sheet is long-format: each row reports, for one
entity (state / county / district / school depending on level) and
one HIB-nature category, the number of investigations alleged, confirmed,
and the per-nature total.
Value
Data frame with entity identifiers, hib_nature,
hib_alleged, hib_confirmed, total_hib_investigations,
the standard aggregation flags (is_state, is_county, is_district,
is_school, is_charter, is_charter_sector,
is_allpublic).
school_year is filtered to the requested year and then removed; end_year identifies the year.
Details
Sheet coverage and harmonization:
The
HIBInvestigationssheet is present in both the School and District/State workbooks for end_year 2018-2025. It is absent from SY2016-17 (end_year 2017), so this function errors for that year.Each entity carries eight rows, one per HIB-nature category:
Ancestry,Disability,Gender,No Identified Nature,Other,Race,Religion,Sexual Orientation.The 2024-25 sheet adds a
school_yearcolumn (single value, e.g."2024-25"); it is filtered and removed. Pre-2025 sheets have noschool_yearcolumn.The raw NJ DOE column names
HIBNature,HIBAlleged,HIBConfirmed, andTotalHIBInvestigationssnake-case to ambiguoushibnature/hiballeged/hibconfirmed/total_hibinvestigations; this function renames them to the more readablehib_nature,hib_alleged,hib_confirmed, andtotal_hib_investigations.Count columns are returned as numeric. Suppressed cells (NJ DOE uses
*,N,-as suppression markers) becomeNA.The SY2019-20 School workbook ships a duplicate sheet named
HIBInvestigations1alongsideHIBInvestigations; this fetcher always reads the canonicalHIBInvestigationssheet.
The companion analysis helper calc_discipline_rates_by_subgroup
is designed for sheets with a subgroup column and an enrollment
denominator (e.g. fetch_disciplinary_removals). The
HIBInvestigations sheet is long-by-hib_nature and has no
enrollment denominator, so calc_* cannot be applied directly; pair
with fetch_enr to compute rates against enrollment.
Examples
if (FALSE) { # \dontrun{
# School-level HIB investigations (latest year)
hib <- fetch_hib_investigations(2025)
# District/state-level counts
hib_dist <- fetch_hib_investigations(2024, level = "district")
# Statewide HIB nature mix (which categories drive the most investigations?)
library(dplyr)
fetch_hib_investigations(2024, level = "district") %>%
filter(is_state) %>%
arrange(desc(total_hib_investigations)) %>%
select(hib_nature, hib_alleged, hib_confirmed, total_hib_investigations)
} # }