read_survey_data | R Documentation |
Reads in the FOKUS survey dataset exported by export_survey_data()
for the specified ballot date in the specified canton and language, optionally merged
with all prior survey datasets for that canton and language.
read_survey_data(
ballot_date = pal::pkg_config_val("ballot_date"),
canton = cantons(ballot_date),
lang = pal::pkg_config_val("lang"),
merged = FALSE,
use_cache = TRUE,
auth_token = pal::pkg_config_val("token_repo_private")
)
ballot_date |
FOKUS-covered ballot date. One of
|
canton |
FOKUS-covered canton name. One of
|
lang |
Language. One of |
merged |
Whether or not to read in the merged dataset that includes the data from all ballot dates up until |
use_cache |
Whether or not to return cached results if possible. Caching is done based on file content hashing, so the file is only newly fetched if it
actually changed since the last download. If |
auth_token |
Personal access token of a gitlab.com account with access to the private FOKUS repository. |
A tibble.
Merged datasets differ from single-ballot-date datasets in two ways:
Column labels (the label
attribute) are
ballot-date-independent, i.e. do not include proposal or election
names, and in case of question rewordings over time, the very
latest question wording of all FOKUS surveys in that canton is
used (which might have been introduced only after ballot_date
). So
be aware that the questions in the labels do not necessarily
correspond to the actual questions asked in the FOKUS survey for
ballot_date
.
Variables whose factor levels vary across ballot dates, such as those capturing skill questions, are converted to type character. Be aware that these variables usually aren’t really comparable over time.
Other data import functions:
read_easyvote_municipalities()
,
read_online_participation_codes()
,
read_private_file()
,
read_voting_register_data_extra()
,
read_voting_register_ids()
,
tidy_cols()
# GitLab PAT with access to the private FOKUS repository is required for this function to work
try(
fokus::read_survey_data(ballot_date = "2023-06-18",
canton = "aargau",
lang = "en") |>
nrow()
)
try(
fokus::read_survey_data(ballot_date = "2023-06-18",
canton = "aargau",
lang = "en",
merged = TRUE) |>
nrow()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.