Skip to contents

What it covers

The Utah scraper returns election results from electionresults.utah.gov. It covers all elections available on the site — generals, primaries, and special elections — currently from 2023 to 2025.

Note: The Utah elections site uses the same Angular/PrimeNG framework as the Georgia SOS site. All scraping uses a headless Chromium browser via Playwright. County scraping is parallelised across up to max_workers browsers (default 4). Utah has 29 counties.


Arguments

Argument Default Description
state "UT", "utah", or "Utah"
year_from NULL Start year, inclusive; NULL = no lower bound
year_to NULL End year, inclusive; NULL = no upper bound
level "all" "all" — statewide + county; "state" — statewide only (much faster); "county" — county-level only
max_workers 4L Parallel Chromium browsers for county scraping

Examples

Statewide + county results for a single year

res <- scrape_elections(state = "UT", year_from = 2024, year_to = 2024)

# Statewide candidate totals
res$state %>%
  select(election_name, office, candidate, party, votes, pct)

# County-level breakdown
res$county %>%
  select(county, office, candidate, party, votes, pct) %>%
  arrange(county, office, desc(votes))

Statewide totals only (faster — skips county scraping)

state_df <- scrape_elections(
  state     = "UT",
  year_from = 2024,
  year_to   = 2024,
  level     = "state"
)

state_df %>%
  select(election_name, office, candidate, party, votes, pct)

All available years

res <- scrape_elections(
  state       = "UT",
  year_from   = 2023,
  year_to     = 2025,
  level       = "state"
)

Filter to a specific county

res <- scrape_elections(state = "UT", year_from = 2024, year_to = 2024)

res$county %>%
  filter(county == "Salt Lake") %>%
  select(election_name, office, candidate, party, votes, pct) %>%
  arrange(office, desc(votes))

Output columns

$state (when level = "all" or "state")

Column Description
election_name Human-readable election name
election_year Calendar year of the election
election_slug URL slug identifying the election
election_date Date string from the page header
result_status Reporting status (e.g. "OFFICIAL RESULTS")
office Office name
localities_reporting "X/Y" localities reporting string
candidate Candidate name (cleaned — (I) and party suffix stripped)
party Party abbreviation
is_incumbent TRUE if (I) appears in raw candidate name
is_winner Always NA — winner marker absent from the site HTML
votes Vote total
pct Percentage of votes
url URL of the election page

$county (when level = "all" or "county")

Same columns as $state, plus:

Column Description
county County name

Performance notes

  • level = "state" is much faster. County scraping opens up to max_workers parallel Chromium browsers across Utah’s 29 counties.
  • Virtual scroll. The site uses Angular virtual scrolling; the scraper automatically scrolls to load all panels before parsing.
  • Limited history. The Utah elections site currently lists elections from 2023 onward. Earlier data is not available through this scraper.