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

Description Usage Arguments Value Examples

View source: R/swiss_json_to_dfr.R

Description

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

Usage

1
2
3
4
5
6
7
8
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

1
2
3
4
5
# 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")

swissdd documentation built on July 17, 2021, 9:06 a.m.