link_responses_to_questions: Link Responses to Questions

Description Usage Arguments Details Value

Description

The columns of the response data must be matched up to their corresponding questions and question-parts in order to analyze them. One of two methods is employed, depending on whether or not the original_first_rows are from Insights or Legacy data.

Usage

1
link_responses_to_questions(questions, responses, original_first_rows)

Arguments

questions

A list of questions selected from a Qualtrics survey

responses

A data frame of responses from a Qualtrics survey

original_first_rows

The original header rows to the CSV response set

Details

If Insights data is used, each question is looped through and the QuestionIDs are used to match response columns to a question.

Otherwise, a much more complicated process is used: each question is looped through, determining the DataExportTag of the question, and the ChoiceDataExportTags of the question. The DataExportTag might look like a variable name that has been set by the user in Qualtrics, or an automatically generated name like "QID1" or "QID1.1". The columns with names automatically generated by Qualtrics usually are of a form starting with the DataExportTag, followed by an underscore, and then more details. Sometimes they are exactly the DataExportTag without any modification. Lastly, if the user sets their own variable naming in Qualtrics, then the question contains in its [['Payload']] the [['ChoiceDataExportTags']] list, which contains these user defined variables. This function goes through each question, determines the DataExportTag and ChoiceDataExportTags, and uses each to select the matching columns of the responses. Those are then inserted into that specific question under [['Responses']], and the whole questions list is returned. One small caveat is that if the column name starts with an integer, then R will prepend it with an "X", so there is a helper function included here to include those columns with prepended "X"s as well.

Value

The updated list of questions, each including its relevant response columns as a data frame stored in [['Responses']].


ctesta01/qualtrics-R-package documentation built on May 14, 2019, 12:28 p.m.