canton_json_to_dfr: Transform a opendata.swiss cantonal results json into a...

Description Usage Arguments Value Examples

View source: R/canton_json_to_dfr.R

Description

canton_json_to_dfr tranforms a single results json for a selected cantonal votedate into a tibble.

Usage

1
2
3
4
5
6
7
canton_json_to_dfr(
  votedate = NULL,
  geolevel = "municipality",
  dataurl = NULL,
  index = NULL,
  call_res
)

Arguments

votedate

date of the ballot. Default: most recent ballot available.

geolevel

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

dataurl

list of datasets / metadata for the given dataset and its resources OR url of the dcat dataset on opendata.swiss

index

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

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
# Get and transform the json for the most recent vote
results <- canton_json_to_dfr()

# Get and transform the json for a single votedate at counting district level
canton_json_to_dfr(votedate = "2020-02-09", geolevel = "zh_counting_districts")

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