Skip to contents

Loads and processes NH DOE Bureau of School Finance data into the canonical tidy finance schema. Two datasets are combined:

  • Cost Per Pupil by District (FY2008-FY2025) – district-level per-pupil current operating cost by grade band, plus a statewide average. Metrics: per_pupil_total, per_pupil_elementary, per_pupil_middle, per_pupil_high (is_per_pupil = TRUE).

  • State Summary Revenue & Expenditures (FY2008-FY2020) – statewide revenue by source and expenditure by function (is_per_pupil = FALSE).

Years are school-year ends / fiscal years (FY2025 = the 2024-25 school year).

Usage

fetch_finance(
  end_year,
  tidy = TRUE,
  use_cache = TRUE,
  source = NULL,
  max_age_days = NULL,
  refresh = FALSE
)

Arguments

end_year

School year end (e.g., 2025 = FY2025 / 2024-25). Run get_available_finance_years() to see available years.

tidy

If TRUE (default), returns the long canonical schema (one row per entity x metric). If FALSE, returns the wide source-faithful frame (one row per entity, one column per metric).

use_cache

If TRUE (default), uses locally cached results when available; set FALSE to force a fresh read from bundled data.

source

Requested acquisition mode: "package" (default) or explicit "live" where a runtime producer exists. Retained-only surfaces reject live requests; refresh their files through the documented manual harvest.

max_age_days

Maximum reusable live-cache age in elapsed 24-hour days.

refresh

Force live retrieval. Valid only in live mode.

Value

Data frame of finance data. Tidy columns: 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.

Examples

if (FALSE) { # \dontrun{
# FY2025 finance (2024-25 school year)
fin <- fetch_finance(2025)

# Statewide average cost per pupil
fin |>
  dplyr::filter(is_state, metric == "per_pupil_total") |>
  dplyr::select(end_year, entity_name, value)

# The most expensive districts
fin |>
  dplyr::filter(is_district, metric == "per_pupil_total") |>
  dplyr::arrange(dplyr::desc(value)) |>
  dplyr::select(entity_name, value) |>
  head(10)

# Wide format (metrics as columns)
fetch_finance(2025, tidy = FALSE)
} # }