Skip to contents

New Hampshire facilities data is published across several state sources: the NHED 2018-2019 school facility survey, the NHED FY2026 proposed building-aid ranked list, the NHDES LeadInSchools ArcGIS service, and NHED unused-facility survey PDFs. fetch_facilities() dispatches by category and returns one canonical long schema with source provenance on every row.

Usage

fetch_facilities(
  category,
  year = NULL,
  tidy = TRUE,
  use_cache = TRUE,
  source = NULL,
  max_age_days = NULL,
  refresh = FALSE
)

Arguments

category

One of the facilities category strings. Run get_available_facilities() for the categories currently shipped.

year

Optional source year/vintage filter. NULL returns all shipped vintages for the category. Facilities sources are mostly snapshots; if no vintage contains the requested year, the latest available source rows are returned with a message.

tidy

If TRUE (default), return the canonical long schema. Facilities has no separate wide form yet, so tidy = FALSE returns the same schema.

use_cache

If TRUE (default), use cached live NHDES ArcGIS downloads when fresh. Bundled NHED files are always read from inst/extdata.

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

A data frame with columns category, entity_level, entity_id, entity_name, metric, value, unit, source_agency, source_type, source_url, vintage, nces_dist, and nces_sch.

Details

New Hampshire currently ships honest partial coverage: inventory, attributes, capital_needs, projects, finance, environmental, and closures. The controlled vocabulary also includes capacity and condition, but no verified populated public statewide capacity/utilization or FCI/condition-score dataset was found, so those categories error with a source-coverage message rather than returning placeholders.

value is always character so numeric and categorical metrics can coexist. Cast numeric metrics on use, for example as.numeric(value).

Examples

if (FALSE) { # \dontrun{
# Building attributes from the NHED 2018-2019 facility survey
attrs <- fetch_facilities("attributes")

# FY2026 proposed building-aid projects and awards
projects <- fetch_facilities("projects")

# Lead-in-schools outlet results from NHDES
lead <- fetch_facilities("environmental")

# Cast numeric metrics on use
library(dplyr)
attrs |>
  filter(metric == "gross_sq_ft") |>
  mutate(gross_sq_ft = as.numeric(value))
} # }