Fetch NJ school finance in the canonical cross-state schema
Source:R/fetch_finance.R
fetch_finance.RdThe uniform front door for NJ school finance. Consolidates the
two NJ DOE finance sources this package already pulls - per-pupil spending
from the Taxpayers' Guide to Educational Spending (fetch_tges)
and total K-12 state aid from the Governor's Budget Message district details
(fetch_state_aid) - onto one tidy schema with a standard
metric vocabulary, so cross-state code works unchanged.
Usage
fetch_finance(
end_year,
tidy = TRUE,
use_cache = TRUE,
with_status = FALSE,
level = "all",
allow_partial = FALSE
)Arguments
- end_year
school year (end of the academic year). See
get_available_finance_yearsfor valid values.- tidy
logical, default
TRUE. The tidy long schema is the only supported (and only) shape;tidy = FALSEcurrently returns the same long frame and is reserved for a future wide form.- use_cache
logical, default
TRUE. Reserved for parity with other fetchers; the underlying TGES/state-aid downloads use the package session cache.- with_status
logical, default
FALSE. IfTRUE, addsvalue_status, classifying present values asactual, current per-pupil actuals not yet published asnot_yet_observed, and missing values with absent per-pupil denominators asnot_published.- level
entity grain to return:
"all"(default, state and district rows),"state","district", or"school". School-level NJ finance is not published in this fetcher; school requests return structural gap rows only.- allow_partial
logical, default
FALSE. Strict mode fails when a required source is unavailable or cannot be parsed. SetTRUEdeliberately to return successful components and inspectget_source_results()for the missing component.
Value
A tibble in the canonical finance schema: end_year,
state_id, entity_name, county, is_state,
is_district, is_school, is_charter, nces_dist,
nces_sch, metric, value, is_per_pupil,
enrollment_denominator, and optionally value_status.
Details
FY <-> SY mapping. end_year is the fiscal / school year END:
end_year = 2024 is FY2024, school year 2023-24. NJ publishes a year's
spending ACTUALS in the guide released the following year, so the spending
side fetches the end_year + 1 guide and keeps the actuals; state aid is
appropriated for the named year and is read directly.
Metrics emitted.
per_pupil_total- total per-pupil expenditures (ESSA-style), withenrollment_denominator= average daily enrollment plus sent pupils. Carries a statewide-average row (is_state).per_pupil_instruction- classroom instruction per pupil.per_pupil_support_services,per_pupil_administration,per_pupil_operations_maintenance,per_pupil_food_service- NJ-specific per-pupil category metrics (NJ reports these per-pupil rather than as absolute totals).revenue_state- total K-12 state aid (absolute dollars). Carries a statewide-total row.
Years 2025+ carry revenue_state only (that year's spending actuals are
not yet published); years before 2019 carry per-pupil spending only. Values
are nominal dollars exactly as published - no rescaling, no fabrication. The
federal nces_dist identifier is attached from the bundled CCD
crosswalk; unmatched districts keep NA.
Entity grain. NJ finance in this front door is district/state only.
NJ's school-level per-pupil expenditure reporting is a separate source that
is not wired here, so is_school remains FALSE. If
level = "school" is requested, the function returns structural gap
rows; use with_status = TRUE to see value_status =
"not_published" for those rows.
Examples
if (FALSE) { # \dontrun{
library(dplyr)
# One year, all metrics
fin <- fetch_finance(2024)
fin %>% count(metric)
# Per-pupil total spending, highest-spending districts
fetch_finance(2024) %>%
filter(is_district, metric == "per_pupil_total") %>%
arrange(desc(value)) %>%
select(entity_name, value, enrollment_denominator)
# Statewide per-pupil total
fetch_finance(2024) %>%
filter(is_state, metric == "per_pupil_total") %>%
select(end_year, value)
# Total K-12 state aid for one district
fetch_finance(2024) %>%
filter(metric == "revenue_state", state_id == "3570") %>%
select(entity_name, value)
} # }