mtschooldata fetches Montana enrollment data from official OPI/GEMS sources with strict provenance.
Part of the njschooldata family.
Full documentation — reference docs and vignettes.
Highlights
1. State enrollment is available with strict official provenance for 2025 and 2026
library(mtschooldata)
library(dplyr)
years <- get_available_years()
state_trend <- fetch_enr_multi(years) |>
filter(is_state, subgroup == "total_enrollment", grade_level == "TOTAL") |>
select(end_year, n_students) |>
arrange(end_year)
state_trend
State trend
2. District rankings are available in the latest supported year
latest_year <- max(get_available_years())
top_districts <- fetch_enr(latest_year) |>
filter(is_district, subgroup == "total_enrollment", grade_level == "TOTAL") |>
arrange(desc(n_students)) |>
select(district_name, n_students) |>
slice_head(n = 10)
top_districts
Top districts
3. Wide and tidy outputs maintain count fidelity
latest_year <- max(get_available_years())
wide <- fetch_enr(latest_year, tidy = FALSE)
tidy <- fetch_enr(latest_year, tidy = TRUE)
wide_total <- sum(wide$row_total[wide$type == "State"], na.rm = TRUE)
tidy_total <- tidy |>
filter(is_state, subgroup == "total_enrollment", grade_level == "TOTAL") |>
pull(n_students)
c(wide_total = wide_total, tidy_total = tidy_total)Data Taxonomy
| Category | Years | Function | Details |
|---|---|---|---|
| Enrollment | 2025-2026 |
fetch_enr() / fetch_enr_multi()
|
State, district, school. Total enrollment counts from official OPI/GEMS exports |
| Assessments | — | — | Not yet available |
| Graduation | — | — | Not yet available |
| Directory | — | — | Not yet available |
| Per-Pupil Spending | — | — | Not yet available |
| Accountability | — | — | Not yet available |
| Chronic Absence | — | — | Not yet available |
| EL Progress | — | — | Not yet available |
| Special Ed | — | — | Not yet available |
See the full data category taxonomy
Quick Start
R
install.packages("remotes")
remotes::install_github("almartin82/mtschooldata")
library(mtschooldata)
fetch_enr(2026)Data Notes
- Source: Montana OPI GEMS Enrollment Dashboard (gemsapi.opi.mt.gov)
- Supported years: 2025-2026 (strict district+school parity)
- Provenance: file-level manifest with URLs, checksums, and download dates in
inst/extdata/enrollment/manifest.csv - Runtime guardrail: no synthetic/fabricated enrollment fallback; unsupported years fail loudly