question_get_choice_labels: Convert kobo xml choice names to labels

Description Usage Arguments Details Value See Also Examples

View source: R/closure_defaults.R

Description

Uses a loaded kobo questionnaire to get the labels of select_one and select_multiple type questions.

Usage

1
question_get_choice_labels(responses, variable.name)

Arguments

responses

A vector of responses in kobo xml name format

variable.name

The xml name of a kobo question. (as it appears in the kobo questionnaire and subsequently in the data column headers) Should be a question of type 'select_one' or 'select_multiple'.

Details

To use this you must first successfully run load_questionnaire. If conversion of a value in responses fails, the original input value is returned. This happens in the following cases:

This does not work for concatenated responses of 'select_multiple' questions (e.g. strings of the form "choice_a choice_b"); The responses should have only a single response per element.

Value

A vector of strings with labels corresponding to the choices supplied in responses.

See Also

load_questionnaire must be run first. The equivalent of this but for question labels is question_get_question_label,

Examples

1
question_get_choice_labels(mydata$location, "location")

mabafaba/koboquest documentation built on Aug. 15, 2019, 6:12 p.m.