Returns a data frame listing the earliest available year for each state and scraper source tracked by DownBallotR. All sources include data through the current calendar year.
Usage
db_available_years(
state = NULL,
office = c("general", "school_district", "state_elections", "municipal_elections")
)Arguments
- state
Optional state name to filter results (e.g.
"virginia"). PassNULL(default) to return all states for the chosen source(s).- office
Type of election, matching
scrape_elections()."general"(default) returns availability for ElectionStats states and North Carolina;"school_district"returns Ballotpedia school board availability;"state_elections"returns Ballotpedia state election availability;"municipal_elections"returns Ballotpedia municipal and mayoral election availability (2014+ for"all", 2020+ for"mayoral").
Examples
if (FALSE) { # \dontrun{
# General election sources
db_available_years()
# School district (Ballotpedia)
db_available_years(office = "school_district")
# State elections (Ballotpedia)
db_available_years(office = "state_elections")
# Municipal and mayoral elections (Ballotpedia)
db_available_years(office = "municipal_elections")
# Filter to one state
db_available_years(state = "virginia")
} # }