qstnr_item_val | R Documentation |
Extracts a single questionnaire item field value for every first- for every second-level iterator from the raw FOKUS questionnaire data based on the specified variable name and branch path.
qstnr_item_val(
ballot_date = pal::pkg_config_val("ballot_date"),
canton = cantons(ballot_date),
branch_path,
var_name,
key = qstnr_item_keys$key,
lvl = "?",
i = NA_integer_,
j = NA_integer_
)
ballot_date |
FOKUS-covered ballot date. One of
|
canton |
FOKUS-covered canton name. One of
|
branch_path |
Sequence of questionnaire table levels that lead to the |
var_name |
Variable name, without resolved string interpolation, i.e. 1:1 as stated in the raw FOKUS questionnaire data. A character scalar. |
key |
Questionnaire item key. One of
|
lvl |
Political-level loop iterator that can be referred to in field value via string interpolation. A character vector. |
i |
Second-level loop iterator that can be referred to in field value via string interpolation. An integerish vector. |
j |
Third-level loop iterator that can be referred to in field value via string interpolation. An integerish vector. |
When used in questionnaire item field values via string interpolation, be careful to not create infinite loops via circular references.
A vector of the resolved item field values. Type and length of resolved values depend on key
.
Other questionnaire-internal functions:
qstnr_parties()
,
qstnr_response_option_codes()
fokus:::qstnr_item_val(ballot_date = "2018-09-23",
canton = "aargau",
branch_path = c("03_proposal_specific", "004_participants"),
var_name = "appeal_federal_proposals",
key = "include")
fokus:::qstnr_item_val(
ballot_date = "2019-10-20",
canton = "aargau",
branch_path = c("02_political_start", "002_non_participation",
"003_election", "z01_hypothetical"),
var_name = "hypothetical_voting_decision_federal_majoritarian_election_{i}_seat_{j}",
key = "topic",
i = 1:2,
j = 1:3
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.