Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ordered factor conversion for multiple choice question #342

Open
Haunfelder opened this issue Apr 29, 2024 · 2 comments · May be fixed by #343
Open

Ordered factor conversion for multiple choice question #342

Haunfelder opened this issue Apr 29, 2024 · 2 comments · May be fixed by #343

Comments

@Haunfelder
Copy link

It looks like the wrap_mc function in the utils.R script uses "choiceText" from the survey metadata as the factor levels, which isn't guaranteed to match the response values returned from fetchsurveys. This causes an error if, for example, the choice text has a capital letter in it, but the variable name does not. It seems like "variableName" would be a better choice for the levels, though I am new to Qualtrics, so I may be misinterpreting these values.

"choiceText")),

@juliasilge
Copy link
Collaborator

Hmmmmm, I might need more information to understand what you are saying. Take a look at this example survey: https://conjoint.qualtrics.com/jfe/form/SV_3gbwq8aJgqPwQDP
(Also, feel free to fill it out. 😜 )

That first question is multiple choice, and when I look at choiceText, I get what I believe should be the factor levels, at least after remove_html() gets run:

[1] "<span style=\"color:#8e44ad;\">Daily</span>"                              
[2] "Weekly"                                                                   
[3] "Once a <span style=\"background-color:#9b59b6;\">month</span>"            
[4] "<a href=\"https://www.instagram.com/p/B5qn5ath0ij/?hl=en\">Less often</a>"
[5] "Do not use"    

For this question, variableName is NULL for all the options. Do you see something different?

@Haunfelder
Copy link
Author

Thanks @juliasilge, I realize this isn't much to go on. I'm having difficulty creating a reprex because I don't have a Qualtrics account with my organization and I don't have API access with my free account. The problem appears for questions where Recode Values and Variable Names are both checked and the names don't match the levels in the question. The "choiceText" returned by fetch_survey matches the capitalized values in the screenshot, while the responses come back from the API with the variable names. This error only happens when label and convert are both T, because it calls infer_data_types.

image

I suspect that responses are returned from the export-responses endpoint with "variableName" levels if they exist, otherwise "choiceText". I know this is a lot to ask, but is that enough to make a reprex?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants