| Question | R Documentation | 
R6 Class representing a LimeSurvey question
R6 Class representing a LimeSurvey question
A question has at least a code and a primary language.
The human-readable question types are (with some additional variants also being valid, in any case the literal labels used at https://www.limesurvey.org/manual/Question_object_types#Current_question_types):
 "array dual scale"
 "5 point choice"
 "5 point array"
 "10 point array"
 "yes/no/uncertain array"
 "date"
 "increase/same/decrease array"
 "array" (this is the "array (flexible labels)" type)
 "gender"
 "array by column"
 "language switch"
 "multiple numerical input",
 "radio" (this is the "list" type)
 "checkboxes" (this is the "multiple choice" type)
 "numerical input",
 "list with comment"
 "multiple choice with comments"
 "multiple short text"
 "ranking"
 "short text"
 "long text"
 "huge text"
 "text display"
 "yes/no"
 "multiple texts array",
 "multiple dropdown array"
 "file"
 "dropdown"
 "equation".
codeThe code of the question.
idThe identifier of the question (a unique number in a survey).
gidThe identifier of the group to which this question belongs.
sidThe identifier of the survey to which this question belongs.
typeThe question type.
lsTypeThe question type in LimeSurvey's format.
questionTextsThe question text(s) in all languages.
helpTextsThe question help text(s) in all languages.
relevanceThe relevance.
validationThe question's validation.
languageThe primary language of the question.
additional_languagesAny additional languages for the title and description elements.
answerOptionsThe answer options in the question.
subquestionsThe subquestions in the question.
parent_qidThe question identifier of the parent question (or 0).
mandatoryWhether the question is mandatory (Y or N).
otherWhether the question has an 'other' option (Y or N).
otherReplaceTextsIf the question has an 'other' option, its label if the default label should be overwritten (multilingual).
defaultThe default value.
same_defaultNot entirely sure what this does.
array_filterThe question code of the array filter question to apply.
question_orderThe question order (starts at 0)
cssclassThe CSS class(es) to apply to this question.
hide_tipWhether to hide the tip (Y or N).
otherOptionsAny additional options, stored as a named list
by assigning as.list(...).
has_subquestionsWhether the question has subquestions.
has_answerOptionsWhether the question has answer options
new()Create a new question object. Most of this text comes directly from the TSV manual page at https://www.limesurvey.org/manual/Tab_Separated_Value_survey_structure, so please see that page for more details.
Question$new( code, type = NULL, lsType = NULL, id = NULL, gid = NULL, sid = NULL, questionTexts = "", helpTexts = "", relevance = 1, validation = "", mandatory = "N", parent_qid = 0, other = "N", otherReplaceTexts = "", default = "", same_default = "0", array_filter = "", cssclass = "", hide_tip = "", language = "en", additional_languages = "", new_id_fun = NULL, question_order = 0, ... )
codeThe question code.
typeThe human-readable question type (see details).
lsTypeThe type as LimeSurvey type ("1"; "5"; "A" to "Y",
except "J", "V" and "W"; "!"; ":"; ";"; "*"; or "|" –see
https://www.limesurvey.org/manual/Question_object_types#Current_question_types).
idThe identifier of the question (in a survey).
gidThe identifier of the group to which this question belongs.
sidThe identifier of the survey to which this question belongs.
questionTextsThe question text(s).
helpTextsThe help text(s).
relevanceThe question's relevance equation.
validationThe question's validation.
mandatoryWhether the question is mandatory (Y or N);.
parent_qidThe question identifier of the parent question (or 0).
otherWhether the question has an 'other' option (Y or N).
otherReplaceTextsIf the question has an 'other' option, its label if the default label should be overwritten (multilingual).
defaultThe default value.
same_defaultY for true, in which case any default value set
for the primary language applies to other languages.
array_filterThe question code of the array filter question to apply.
cssclassThe CSS class(es) to apply to this question.
hide_tipWhether to hide the tip (Y or N).
languageThe question's primary language.
additional_languagesAny additional languages
new_id_funA function to set identifiers (for XML exports, which mirrors MySQL tables and so needs identifiers). By default, new question objects receive this function from the group containing them; and groups receive it from the survey containing them. This ensures that identifiers are always unique in a survey (despite question objects not being able to 'see' anything in the group containing them, and group objects not being able to 'see' anything in the survey containing them; because they 'received' this function from the parent object, and it 'bubbles down' through groups to the questions, those functions still get and set a private identifier property in the 'top-most' object).
question_orderThe question order (starts at 0)
...Any additional options, stored as a named list in the
otherOptions property by assigning as.list(...).
A new Question object.
add_answer_option()Add an answer option to a question. Most of this text comes directly from the TSV manual page at https://www.limesurvey.org/manual/Tab_Separated_Value_survey_structure, so please see that page for more details.
Question$add_answer_option( code, optionTexts, type.scale = 0, relevance = "", assessment.value = 0, sort.order = NULL )
codeThe answer option code.
optionTextsThe answer option text(s).
type.scale0 or 1 (e.g. for dual-scale; 'scale_id').
relevanceThe answer option's relevance equation.
assessment.valueIf using assessment, this is the assessment value for the answer ('assessment_value').
sort.orderThe sort order (to manually specify); starts at 0. If left empty, new options are added at the bottom.
Invisibly, the question object.
add_subquestion()Add a subquestion to a question. Most of this text comes directly from the TSV manual page at https://www.limesurvey.org/manual/Tab_Separated_Value_survey_structure, so please see that page for more details.
Question$add_subquestion( code, subquestionTexts, relevance = "", helpTexts = NULL, type.scale = 0, validation = "", mandatory = "", default = "", same_default = "", subquestion.order = NULL )
codeThe subquestions code.
subquestionTextsThe subquestion text(s).
relevanceWhen to show this subquestion.
helpTextsAs far as I know not yet implemented in LimeSurvey; but the TSV help page says "(Future) to support subquestion-level help".
type.scale0 or 1, depending upon question type (e.g. array
text will have two scales)0 or 1, depending upon question type (e.g.
array text will have two scales)."
validationAs far as I know not yet implemented in LimeSurvey; but the TSV help page says "(Future) to support subquestion-level regular expression validation (e.g. for address parts)"
mandatoryAs far as I know not yet implemented in LimeSurvey; but the TSV help page says "(Future) to support subquestion-level mandatory (e.g. make only a few subquestions mandatory)"
defaultIf set, then this is the default value for the subquestion (inserted into defaultvalues table).
same_defaultIf set, then the default for the primary language is used for all other languages.
subquestion.orderThe subquestion order (to manually specify); starts at 0. If left empty, new options are added at the bottom.
Invisibly, the question object.
xmlExport_row_question()Export the question in XML format (for lss, lsg, or lsq files).
Question$xmlExport_row_question(silent = limonaid::opts$get("silent"))silentWhether to be silent or chatty.
The produced XML
xmlExport_row_subquestions()Export the question in XML format (for lss, lsg, or lsq files).
Question$xmlExport_row_subquestions(
  returnRows = FALSE,
  silent = limonaid::opts$get("silent")
)returnRowsWhether to return a list with each row as element,
or a rows node (as xml2 object) containing each row as nodes
silentWhether to be silent or chatty.
The produced XML
xmlExport_row_question_l10ns()Export the question's question_l10ns info in a list of XML nodes.
Question$xmlExport_row_question_l10ns(
  id_fun = private$new_id(),
  silent = limonaid::opts$get("silent")
)id_funThe function to use to produce unique identifiers
silentWhether to be silent or chatty.
The produced list of XML nodes
xmlExport_row_answers()Export the answer options in XML format (for lss, lsg, or lsq files).
Question$xmlExport_row_answers(
  returnRows = FALSE,
  silent = limonaid::opts$get("silent")
)returnRowsWhether to return a list with each row as element,
or a rows node (as xml2 object) containing each row as nodes
silentWhether to be silent or chatty.
The produced XML
xmlExport_row_answer_l10ns()Export the question's answer optoin l10ns info in a list of XML nodes.
Question$xmlExport_row_answer_l10ns(
  id_fun = private$new_id,
  silent = limonaid::opts$get("silent")
)id_funThe function to use to produce unique identifiers
silentWhether to be silent or chatty.
The produced list of XML nodes
xmlExport_row_attributes()Export the question's attributes in a list of XML nodes.
Question$xmlExport_row_attributes(silent = limonaid::opts$get("silent"))silentWhether to be silent or chatty.
The produced list of XML nodes
clone()The objects of this class are cloneable with this method.
Question$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.