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):

Public fields

code

The code of the question.

id

The identifier of the question (a unique number in a survey)

type

The question type.

lsType

The question type in LimeSurvey's format.

questionTexts

The question text(s) in all languages.

helpTexts

The question help text(s) in all languages.

relevance

The relevance.

validation

The question's validation.

language

The primary language of the question.

answerOptions

The answer options in the question.

subquestions

The subquestions in the question.

mandatory

Whether the question is mandatory (Y or N).

other

Whether the question has an 'other' option (Y or N).

otherReplaceTexts

If the question has an 'other' option, its label if the default label should be overwritten (multilingual).

default

The default value.

same_default

Not entirely sure what this does.

array_filter

The question code of the array filter question to apply.

cssclass

The CSS class(es) to apply to this question.

hide_tip

Whether to hide the tip (Y or N).

otherOptions

Any 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
code

The question code.

type

The human-readable question type (see details).

lsType

The 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).

id

The identifier of the question (in a survey).

questionTexts

The question text(s).

helpTexts

The help text(s).

relevance

The question's relevance equation.

validation

The question's validation.

mandatory

Whether the question is mandatory (Y or N);.

other

Whether the question has an 'other' option (Y or N).

otherReplaceTexts

If the question has an 'other' option, its label if the default label should be overwritten (multilingual).

default

The default value.

same_default

Y for true, in which case any default value set for the primary language applies to other languages.

array_filter

The question code of the array filter question to apply.

cssclass

The CSS class(es) to apply to this question.

hide_tip

Whether to hide the tip (Y or N).

language

The question's primary language.

...

Any additional options, stored as a named list in the otherOptions property by assigning as.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
code

The answer option code.

optionTexts

The answer option text(s).

type.scale

0 or 1 (e.g. for dual-scale; 'scale_id').

relevance

If 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
code

The subquestions code.

subquestionTexts

The subquestion text(s).

relevance

When to show this subquestion.

helpTexts

As far as I know not yet implemented in LimeSurvey; but the TSV help page says "(Future) to support subquestion-level help".

type.scale

0 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)."

validation

As 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)"

mandatory

As 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)"

default

If set, then this is the default value for the subquestion (inserted into defaultvalues table).

same_default

If 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
deep

Whether to make a deep clone.


[Package limonaid version 0.1.5 Index]