| Question {limonaid} | R Documentation |
R6 Class representing a LimeSurvey question
Description
R6 Class representing a LimeSurvey question
R6 Class representing a LimeSurvey question
Details
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://manual.limesurvey.org/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".
Public fields
codeThe code of the question.
idThe identifier of the question (a unique number in a survey)
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.
answerOptionsThe answer options in the question.
subquestionsThe subquestions in the question.
mandatoryWhether the question is mandatory (
YorN).otherWhether the question has an 'other' option (
YorN).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.
cssclassThe CSS class(es) to apply to this question.
hide_tipWhether to hide the tip (
YorN).otherOptionsAny additional options, stored as a named list by assigning
as.list(...).
Methods
Public methods
Method new()
Create a new question object. Most of this text comes directly from the TSV manual page at https://manual.limesurvey.org/Tab_Separated_Value_survey_structure, so please see that page for more details.
Usage
Question$new( code, type = NULL, lsType = NULL, id = NULL, questionTexts = "", helpTexts = "", relevance = 1, validation = "", mandatory = "N", other = "N", otherReplaceTexts = "", default = "", same_default = "0", array_filter = "", cssclass = "", hide_tip = "", language = "en", ... )
Arguments
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://manual.limesurvey.org/Question_object_types#Current_question_types).idThe identifier of the question (in a survey).
questionTextsThe question text(s).
helpTextsThe help text(s).
relevanceThe question's relevance equation.
validationThe question's validation.
mandatoryWhether the question is mandatory (
YorN);.otherWhether the question has an 'other' option (
YorN).otherReplaceTextsIf the question has an 'other' option, its label if the default label should be overwritten (multilingual).
defaultThe default value.
same_defaultYfor 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 (
YorN).languageThe question's primary language.
...Any additional options, stored as a named list in the
otherOptionsproperty by assigningas.list(...).
Returns
A new Survey object.
Method add_answer_option()
Add an answer option to a question. Most of this text comes directly from the TSV manual page at https://manual.limesurvey.org/Tab_Separated_Value_survey_structure, so please see that page for more details.
Usage
Question$add_answer_option(code, optionTexts, type.scale = 0, relevance = "")
Arguments
codeThe answer option code.
optionTextsThe answer option text(s).
type.scale0or1(e.g. for dual-scale; 'scale_id').relevanceIf using assessment option, this is the assessment value for the answer ('assessment_value').
Returns
Invisibly, the question object.
Method add_subquestion()
Add a subquestion to a question. Most of this text comes directly from the TSV manual page at https://manual.limesurvey.org/Tab_Separated_Value_survey_structure, so please see that page for more details.
Usage
Question$add_subquestion( code, subquestionTexts, relevance = "", helpTexts = NULL, type.scale = 0, validation = "", mandatory = "", default = "", same_default = "" )
Arguments
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.scale0or1, 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.
Returns
Invisibly, the question object.
Method clone()
The objects of this class are cloneable with this method.
Usage
Question$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.