Survey {limonaid} | R Documentation |
R6 Class representing a LimeSurvey survey
Description
R6 Class representing a LimeSurvey survey
R6 Class representing a LimeSurvey survey
Details
Create and work with a Survey to programmatically (or interactively) create a survey, export it to a tab separated values file, and import it to LimeSurvey.
Public fields
titles
The title of the survey in the primary language and any additional languages
descriptions
The descriptions of the survey in the primary language and any additional languages
welcomeTexts
The welcome texts of the survey in the primary language and any additional languages
endTexts
The end texts of the survey in the primary language and any additional languages
endURLs
The end URLs of the survey in the primary language and any additional languages
endURLdescriptions
The end URL descriptions of the survey in the primary language and any additional languages
dateformats
The date format to use in the primary language and any additional languages; the index of the option from the dropdown in LimeSurvey (6 is the ISO standard, "YYYY-MM-DD").
numberformats
The number format to use in the primary language and any additional languages (for periods as decimal marks,
0
; for commas as decimal marks,1
).sid
The unique survey identifier; if this is free when importing the survey, this will be used.
gsid
The Survey Group identifier.
admin
The name of the survey administrator
adminemail
The email address of the survey administrator
anonymized
Whether the survey uses anonymized responses (
Y
orN
).faxto
The contents of the "Fax to" field
format
How to present the survey (
Q
for question by question;G
for group by group; andA
for all in one).savetimings
Whether to save timings of responses (
Y
orN
).template
The name of the LimeSurvey theme to use.
language
The primary language of the survey.
additional_languages
Any additional languages the survey uses.
datestamp
Whether to datestamp responses (
Y
orN
).usecookie
Whether to use cookies to enable answer persistence.
allowregister
Whether to allow public registration (
Y
orN
).allowsave
Whether to allow users to save their responses and returning later (
Y
orN
).autonumber_start
Where to start autonumbering
autoredirect
Whether to automatically redirect users to a URL (
Y
orN
).allowprev
Whether to allow users to return to previous pages (
Y
orN
).printanswers
Whether to allow printing of answer (
Y
orN
).ipaddr
Whether to store IP addresses (
Y
orN
).refurl
Whether to store the referring URL (
Y
orN
).showsurveypolicynotice
Whether to show the data policy notice (
Y
orN
).publicstatistics
Whether to have public statistics (
Y
orN
).publicgraphs
Whether to show graphs in public statistics (
Y
orN
).listpublic
Whether to list the survey publicly (
Y
orN
).htmlemail
Whether to use HTML format for token emails (
Y
orN
).sendconfirmation
Whether to send confirmation emails (
Y
orN
).tokenanswerspersistence
Whether to use token-based response persistence (
Y
orN
).assessments
Whether to use assessments (
Y
orN
).usecaptcha
Whether to use CAPTCHA's (
Y
orN
).usetokens
Whether to use tokens (
Y
orN
).bounce_email
Where bouncing emails should be sent.
emailresponseto
Where detailed admin notifications emails should be sent.
emailnotificationto
Where a notification should be sent for new responses.
tokenlength
The token length.
showxquestions
Whether to show "There are X questions in this survey" (
Y
orN
).showgroupinfo
Whether to show group name and info (
B
for both,?
, orX
to show nothing).shownoanswer
Whether to show the "No answer" option (
Y
orN
).showqnumcode
Whether to show answer codes or numbers (
Y
,N
, orX
to show nothing).bounceprocessing
Whether to process bouncing emails? (
Y
orN
).showwelcome
Whether to show the welcome page (
Y
orN
).showprogress
Whether to show the progress bar (
Y
orN
).questionindex
Whether to show the question index (
0
to disable; can also be set to incremental or full (1
and2
?)).navigationdelay
The navigation delay in seconds
nokeyboard
Whether to show the on-screen keyboard (
Y
orN
).alloweditaftercompletion
Whether to allow multiple reponses (
N
) or to allow updating responses with one token (Y
)?googleanalyticsstyle
The google analytics settings;
0
for None, other values for other settings.googleanalyticsapikey
The google analytics API key.
groups
The groups in the survey.
tsvData
Used to store the dataframe saved to a file as tab separated values.
Active bindings
get_group_ids
A list of all group ids.
get_group_titles
A list of all group ids.
Methods
Public methods
Method new()
Create a new survey object.
Usage
Survey$new( titles, descriptions = "", welcomeTexts = "", endTexts = "", endURLs = "", endURLdescriptions = "", dateformats = 6, numberformats = 0, sid = 1, gsid = 1, admin = "Admin Name", adminemail = "email@add.ress", anonymized = "Y", faxto = "", format = "G", savetimings = "Y", template = "vanilla", language = "en", additional_languages = "", datestamp = "Y", usecookie = "N", allowregister = "N", allowsave = "N", autonumber_start = 0, autoredirect = "Y", allowprev = "N", printanswers = "N", ipaddr = "N", refurl = "N", showsurveypolicynotice = "0", publicstatistics = "N", publicgraphs = "N", listpublic = "N", htmlemail = "Y", sendconfirmation = "N", tokenanswerspersistence = "N", assessments = "N", usecaptcha = "N", usetokens = "N", bounce_email = "", emailresponseto = "", emailnotificationto = "", tokenlength = 15, showxquestions = "N", showgroupinfo = "X", shownoanswer = "N", showqnumcode = "X", bounceprocessing = "N", showwelcome = "N", showprogress = "N", questionindex = "0", navigationdelay = "0", nokeyboard = "N", alloweditaftercompletion = "N", googleanalyticsstyle = 0, googleanalyticsapikey = "" )
Arguments
titles
The titles of the survey in the primary language and optionally any addiitonal languages.
descriptions
The descriptions of the survey in the primary language and any additional languages
welcomeTexts
The welcome texts of the survey in the primary language and any additional languages
endTexts
The end texts of the survey in the primary language and any additional languages
endURLs
The end URLs of the survey in the primary language and any additional languages
endURLdescriptions
The end URL descriptions of the survey in the primary language and any additional languages
dateformats
The date formats to use in the primary language and any additional languages; the index of the option from the dropdown in LimeSurvey (6 is the ISO standard, "YYYY-MM-DD").
numberformats
The number formats to use in the primary language and any additional languages (for periods as decimal marks,
0
; for commas as decimal marks,1
).sid
The unique survey identifier; if this is free when importing the survey, this will be used.
gsid
The Survey Group identifier.
admin
The name of the survey administrator
adminemail
The email address of the survey administrator
anonymized
Whether the survey uses anonymized responses (
Y
orN
).faxto
The contents of the "Fax to" field
format
How to present the survey (
Q
for question by question;G
for group by group; andA
for all in one).savetimings
Whether to save timings of responses (
Y
orN
).template
The name of the LimeSurvey theme to use.
language
The primary language of the survey.
additional_languages
Any additional languages the survey uses.
datestamp
Whether to datestamp responses (
Y
orN
).usecookie
Whether to use cookies to enable answer persistence.
allowregister
Whether to allow public registration (
Y
orN
).allowsave
Whether to allow users to save their responses and returning later (
Y
orN
).autonumber_start
Where to start autonumbering
autoredirect
Whether to automatically redirect users to a URL (
Y
orN
).allowprev
Whether to allow users to return to previous pages (
Y
orN
).printanswers
Whether to allow printing of answer (
Y
orN
).ipaddr
Whether to store IP addresses (
Y
orN
).refurl
Whether to store the referring URL (
Y
orN
).showsurveypolicynotice
Whether to show the data policy notice (
Y
orN
).publicstatistics
Whether to have public statistics (
Y
orN
).publicgraphs
Whether to show graphs in public statistics (
Y
orN
).listpublic
Whether to list the survey publicly (
Y
orN
).htmlemail
Whether to use HTML format for token emails (
Y
orN
).sendconfirmation
Whether to send confirmation emails (
Y
orN
).tokenanswerspersistence
Whether to use token-based response persistence (
Y
orN
).assessments
Whether to use assessments (
Y
orN
).usecaptcha
Whether to use CAPTCHA's (
Y
orN
).usetokens
Whether to use tokens (
Y
orN
).bounce_email
Where bouncing emails should be sent.
emailresponseto
Where detailed admin notifications emails should be sent.
emailnotificationto
Where a notification should be sent for new responses.
tokenlength
The token length.
showxquestions
Whether to show "There are X questions in this survey" (
Y
orN
).showgroupinfo
Whether to show group name and info (
Y
,N
, orX
to show nothing).shownoanswer
Whether to show the "No answer" option (
Y
orN
).showqnumcode
Whether to show answer codes or numbers (
Y
,N
, orX
to show nothing).bounceprocessing
Whether to process bouncing emails? (
Y
orN
).showwelcome
Whether to show the welcome page (
Y
orN
).showprogress
Whether to show the progress bar (
Y
orN
).questionindex
Whether to show the question index (
0
to disable; can also be set to incremental or full (1
and2
?)).navigationdelay
The navigation delay in seconds
nokeyboard
Whether to show the on-screen keyboard (
Y
orN
).alloweditaftercompletion
Whether to allow multiple reponses (
N
) or to allow updating responses with one token (Y
)?googleanalyticsstyle
The google analytics settings;
0
for None, other values for other settings.googleanalyticsapikey
The google analytics API key.
Returns
A new Survey
object.
Method add_group()
Add a group to a survey object.
Usage
Survey$add_group(titles, descriptions = "", relevance = 1, random_group = "")
Arguments
titles
The group's title, either as a named character vector where each element is the group title in a different language, and every element's name is the language code; or as a single character value, in which case the survey's primary language is used.
descriptions
The group description, either as a named character vector where each element is the group description in a different language, and every element's name is the language code; or as a single character value, in which case the survey's primary language is used.
relevance
The group's relevance equation.
random_group
The group's randomization group.
Returns
Invisibly, the Survey
object.
Method add_question()
Add a question to a survey object.
Usage
Survey$add_question(groupId, code, type = NULL, lsType = NULL, ...)
Arguments
groupId
The id of the group to add the question to.
code
The question code.
type
The question type.
lsType
The question type, as LimeSurvey question type.
...
Additional arguments are used to create the Question using
Question$new
.
Returns
Invisibly, the Survey
object.
Method export_to_tsv()
Export the survey as a tab separated values file (see https://manual.limesurvey.org/Tab_Separated_Value_survey_structure).
Usage
Survey$export_to_tsv( file, preventOverwriting = limonaid::opts$get("preventOverwriting"), parallel = TRUE, encoding = limonaid::opts$get("encoding"), silent = limonaid::opts$get("silent"), backupLanguage = self$language )
Arguments
file
The filename to which to save the file.
preventOverwriting
Whether to prevent overwritting.
parallel
Whether to work serially or in parallel.
encoding
The encoding to use
silent
Whether to be silent or chatty.
backupLanguage
The language to get content from if not from the primary langage.
Returns
Invisibly, the Survey
object.
Method find_group_id()
Find the numeric group identifier by group title.
Usage
Survey$find_group_id(title, titleLanguage = NULL)
Arguments
title
The survey title.
titleLanguage
The language in which to search.
Returns
Invisibly, the Survey
object.
Method clone()
The objects of this class are cloneable with this method.
Usage
Survey$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.