View source: R/setQuestionLabels.R
set_question_labels | R Documentation |
LimeSurvey offers the option to export survey result data as an R data frame. Column names are question
codes while variable values are response codes. This function assigns the question or sub-question texts in the selected
language to each variable (column). The question text is available as attribute "label" for each column. Useful in
conjunction with sjlabelled::get_label()
or ggplot
which can automatically retrieve variable
labels for graphics and/or frequency tables.
set_question_labels(data, labels, plang)
data |
Data frame of LimeSurvey R result data set. |
labels |
Data frame extracted from LimeSurvey *.lss xml file. See |
plang |
char language code. One of the available language codes from the survey |
Speical case conserns question and sub-question texts. For example a question might inquire how respondents rate their job satisfaction along several dimensions. In such a question, the overarching question could be:
"Q1. To what extent do you agree or disagree with the following statements about your job?"
Respondents can then indicate their agreement via likert scale answer options on the sub-questions such as:
"Q1-S1. My job offers good prospects for career advancement" "Q1-S2. I generally get on well with my work colleagues" "Q1-S3. I might lose my job in the next 6 months" etc.
The individual responses to each sub-question are then stored in the corresponding columns of the result data
frame. In case a column holds a sub-question, the "label" stores the sub-question text, e.g. "My job offers
good prospects for career advancement", etc. This makes sense to take advantage of the plotting likert scales with
the correct sub-question label attached for each item. In case of sub-questions, the corresponding parent question
text (e.g. "Q1. To what extent do you agree ...") is stored with a distinct attribute "parent_label". It can be
retrieved with get_lsParentlabel
.
data frame with attached text label for each variable (question or sub-question).
extract_question_labels
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.