`fetch_enr` is a wrapper around `get_raw_enr` and `process_enr` that downloads and cleans enrollment data for a given year.
Arguments
- end_year
A school year. Year is the end of the academic year - eg 2006-07 school year is year '2007'. Valid values are 1999-2026.
- tidy
If TRUE, takes the unwieldy wide data and normalizes into a long, tidy data frame with limited headers - constants (school/district name and code), subgroup (all the enrollment file subgroups), program/grade and measure (row_total, free lunch, etc).
- use_cache
If TRUE, uses the session cache to avoid re-downloading data. See
njsd_cache_infofor cache details.
Value
Data frame with processed enrollment data. Program counts come
directly from the workbook where the count column exists. A masked count
stays missing. For district and school worksheets with only a percentage,
the count is computed as `pct / 100 * row_total` from the same entity/year's
published total enrollment, without rounding. `tidy = TRUE` output carries a
`value_source` column
(`"published"`, `"derived_from_pct"`, or `"published_pct_only"`; see
tidy_enr) and `tidy = FALSE` wide output carries the same
provenance per field as `<field>_value_source` (eg `lep_value_source`).
Pre-2020 files publish these fields as real counts directly (`"published"`).
From 2023, the workbook's program rates are available as percentages in
wide `<field>_published_pct` columns and fractions in tidy `published_pct`.
The statewide Non-Binary count and rate are retained when published.
For 2024 (SY2023-24) NJ DOE printed Non-Binary = 0 in every statewide row,
a category it did not collect that year, so those counts and rates are `NA`
with value source `"not_reported"`.
Tidy `pct` remains the count divided by the row total.