Description Usage Arguments Details Examples
View source: R/update_question.R
Versatile function to change the behavior of a question and the survey.
1 | update_question(qsf, id_name, id, ...)
|
qsf |
qsf file as R list |
id_name |
which question ID to use: "PrimaryAttribute" or "SecondaryAttribute"? |
id |
Value of |
... |
key-value tuples (see details) |
The list below catalogs some of common keys that control the behavior of a question. The function accepts all key-value tuples.
Validation: A list controlling the validation. Use construct_validation()
to construct.
DisplayLogic : A list controlling the display logic. Use construct_displaylogic()
to construct.
DataExportTag : A string without whitespace.
QuestionJS : A string with JavaScript code attached to the question.
Selector and SubSelector:
Selector | SubSelector | Choice display |
MAVR | 'TX' | Multiple choice |
SAVR | 'TX' | Single choice |
DL | Dropdown | |
SB | Select box | |
MSB | Multi select box | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | data(svy_qsf)
# Change data export tag
qsf <- update_question(qsf,
id_name='SecondaryAttribute',
id='sex',
DataExportTag='gender')
# Convert to multiple choice
qsf <- update_question(qsf,
id_name='SecondaryAttribute',
id='sex',
Selector='MAVR',
SubSelector='TX')
# Forced choice for both questions
qsf_mod <- update_question(svy_qsf,
id_name='SecondaryAttribute',
id=c('sex', 'born'),
Validation=construct_validation(type='force'))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.