get_cantonalvotes: Get cantonal results and counting status in real time or for...

View source: R/get_cantonalvotes.R

get_cantonalvotesR Documentation

Get cantonal results and counting status in real time or for selected dates or a time range in the past

Description

get_cantonalvotes is one of the two main functions of swissvote package. It allows to retrieve the results and the counting status for national ballots.

Usage

get_cantonalvotes(
  geolevel = "municipality",
  votedates = NULL,
  from_date = NULL,
  to_date = NULL
)

Arguments

geolevel

geographical level for which the results should be loaded. Options: "canton", "district", "municipality" or "zh_counting_districts".

votedates

dates of the ballots to be selected. Default: most recent ballot available. Format: "YYYY-MM-DD".

from_date

starting point in time from which vote results should be retrieved. Format: "YYYY-MM-DD".

to_date

end point in time to which vote results should be retrieved. Format: "YYYY-MM-DD".

Details

get_cantonalvotes - retrieve vote results for cantonal ballots at district- or municipality level for selected dates or a given date range.

Value

a tibble containing the results

Examples


# Select by range
results <- get_cantonalvotes(
   geolevel = "district", 
   from_date = "2019-01-01", 
   to_date = "2019-12-31"
   )

# Select specific votedate(s)
get_cantonalvotes(votedates = "2019-02-10")

# get the results at counting district level
# yields the same result as the municipality level, with the 
# exception of Winterthur and Zurich,
# where detailed counting district results are returned instead.

get_cantonalvotes(votedate = "2019-09-22", geolevel = "zh_counting_districts")


politanch/swissdd documentation built on June 12, 2025, 6:42 a.m.