swiss_json_to_dfr: Transform an opendata.swiss national results json into a...

View source: R/swiss_json_to_dfr.R

swiss_json_to_dfrR Documentation

Transform an opendata.swiss national results json into a tibble

Description

swiss_json_to_dfr transforms the json containing the results of a selected federal votedate into a tibble.

Usage

swiss_json_to_dfr(
  votedate = NULL,
  geolevel = "municipality",
  dataurl = NULL,
  index = NULL,
  language = "DE",
  call_res
)

Arguments

votedate

date of the ballot. Default: most recent ballot available. To select multiple ballots use the 'get_swissvotes'-function. Format = YYYYMMDD

geolevel

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

dataurl

url of the dataset on opendata.swiss

index

selection by index of the resource (last published = 1).

language

defines the language of the vote title. Options: "DE" for German, "FR" for French, "IT" for Italian or "RM" for Romansh.

call_res

result of a previous call to the base API. Optional argument.

Value

a tibble containing the results

Examples


# Transform the json of the most recent vote
results <- swiss_json_to_dfr()

# Transform the json of a selected votedate
swiss_json_to_dfr(votedate = "2019-02-10")


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