Learn R Programming

ipanema (version 1.2.0)

get_answer_options: get_answer_options

Description

Get the answer options to a question with pre-defined answer options (e.g. a multiple choice question).

Usage

get_answer_options(question_code)

Value

`data.frame` object with the columns `code` and `answer` in which each row represents one answer option where `code` is the encoded value (as found in datasets exported by `get_survey_data()` and `answer` is the answer option text as seen by survey users).

Arguments

question_code

Code by which to identify the question. Follows a dot-based naming scheme: <group title>.<subquestion title>.

Examples

Run this code
# This example assumes a locally hosted `LimeSurvey` instance using a locally
# hosted MySQL server.
# On this `LimeSurvey` instance, there is a survey with the ID 123456.
# In this survey, a multiple-choice question identified by the code "bdi.01"
# is used.
# For this question, this example retrieves the possible answer options.
if (FALSE) {
connect_to_limesurvey(
  api_url = 'https://localhost/index.php/admin/remotecontrol',
  limesurvey_username = 'admin',
  limesurvey_password = '1234admin',
  mysql_host = '127.0.0.1',
  mysql_port = 3306,
  mysql_dbname = 'limesurvey',
  mysql_table_prefix = '',
  mysql_username = 'lime',
  mysql_password = '1234lime'
)

answer_options <- get_answer_options("bdi.01")
}

Run the code above in your browser using DataLab