Bridge between R and LimeSurvey
This package is a LimeSurvey RemoteControl 2 JSON-RPC API Client for R.
if (!require("devtools")) install.packages("devtools") devtools::install_github("k127/LimeRick")
library(LimeRick) #> #> Welcome to LimeRick package version: 0.2.0 #> #> Package website: http://k127.github.io/LimeRick #> #> Changelog: news(package = "LimeRick") #> Package help: help(LimeRick) #> #> If you find this package useful cite it please. Thank you! #> See: citation("LimeRick") #> #> To suppress this message use: #> suppressPackageStartupMessages(library(LimeRick)) #> #> First you need to set login parameters and obtain a session key. #> See the lsGetSessionKey() function help page (?lsGetSessionKey).
# Compare a low level API call … lsAPI(method = "get_session_key", params = list(admin = getOption("lsUser"), password = getOption("lsPass"))) # … to this Higher level API call lsGetSessionKey()
# Get session key for the user and save it to the lsSessionCache environment lsGetSessionKey() # If you work with a specific locale at LimeSurvey you maybe want to set it Sys.setlocale("LC_ALL", "Polish")
# List available surveys (surveyList = lsListSurveys()) # Extract the ID of the first survey in the list surveyID = surveyList$sid[1]
questionList = lsListQuestions(surveyID, lang = "en")
We can access all available question and survey properties. For example:
# Is the survey active? (Y - Yes) lsGetSurveyProperties(surveyID)$active # What is the main text of a given question? lsGetQuestionProperties(13, lang = "en")$question # Is the question mandatory? (Y - Yes) lsGetQuestionProperties(13, lang = "en")$mandatory
lsGetSummary(surveyID)
d = lsExportResponses(surveyID, completionStatus = "complete") tail(d)
# Show possible options for a particular question ls_getAnswerOptions(questionID = 13, lang = "en") # Create a response using question codes: surveyID+"X"+groupID+"X"+questionID response = list('123456X1X12' = "LimeRick", '123456X1X17' = "Adding feedback directly from R", '123456X2X28' = "A2",# Academia '123456X2X29' = "174" # Poland ) # Add the above response to the survey lsAddResponse(surveyID, response)