Downloads and processes enrollment data from Montana's education data systems. Uses Montana OPI data which provides comprehensive enrollment information for all public schools and districts.
Arguments
- end_year
A school year end (for example, 2026 for 2025-26). Valid values are manifest-driven via
get_available_years.- tidy
If TRUE (default), returns data in long (tidy) format with subgroup column. If FALSE, returns wide format.
- use_cache
If TRUE (default), uses locally cached data when available. Set to FALSE to force re-download.
Value
Data frame with enrollment data. Wide format includes columns for district_id, school_id, names, and enrollment counts by demographic/grade. Tidy format pivots these counts into subgroup and grade_level columns.
Examples
if (FALSE) { # \dontrun{
# Get enrollment data for a supported year
years <- get_available_years()
enr_latest <- fetch_enr(max(years))
# Get wide format
enr_wide <- fetch_enr(max(years), tidy = FALSE)
# Force fresh download (ignore cache)
enr_fresh <- fetch_enr(max(years), use_cache = FALSE)
# Filter to specific county
yellowstone <- enr_latest |>
dplyr::filter(grepl("yellowstone", county, ignore.case = TRUE))
} # }