Convenience wrapper that calls fetch_absence() for each year and
binds the results. Skips years that fail (e.g., COVID gap 2020) with
a warning.
Usage
fetch_absence_multi(
end_years,
level = "school",
type = "chronic",
tidy = TRUE,
use_cache = TRUE,
allow_partial = FALSE
)Arguments
- end_years
Integer vector of school years (e.g.,
2017:2024).- level
One of
"school"or"district".- type
One of
"chronic","by_grade","days_absent", or"essa".- tidy
Logical; if
TRUE(default), normalizes subgroup names.- use_cache
Logical; if
TRUE(default), caches each year.- allow_partial
Logical; if
FALSE(default), failed or structurally unavailable years abort the request. IfTRUE, successful years are returned with status from [get_source_results()].
Examples
if (FALSE) { # \dontrun{
# Get all available years of chronic absenteeism
ca_all <- fetch_absence_multi(2017:2024)
# COVID gap: 2020 was not reported, will be skipped with a warning
ca_all <- fetch_absence_multi(2017:2024)
# Multi-year trend by district
library(dplyr)
ca_all %>%
filter(subgroup == "total", is_state) %>%
select(end_year, chronically_absent_rate)
} # }