Closed stijndelaat closed 3 years ago
Hmmmmm, it looks like for some reason R is trying to convert your free text field to a factor, which mean that it thinks the question is one of the kinds that should be a factor, like multiple choice. What kind of question does it say you have, if you try this?
library(qualtRics)
library(tidyverse)
md <- tibble::enframe(metadata("SV_xxx",
get = list(
"questions" = TRUE,
"metadata" = FALSE,
"responsecounts" = FALSE
))[[1]])
md_parsed <- dplyr::mutate(md,
question_type = map(value, "questionType"),
question_name = map_chr(value, "questionName"),
type_supp = map_chr(question_type, "type"),
selector_supp = map_chr(question_type, "selector"),
type_supp = type_supp %in% c("MC"),
selector_supp = selector_supp %in% c("SAVR"),
name_in_survey = question_name %in% names(data),
supported = type_supp & selector_supp & name_in_survey)
md_parsed %>% filter(name == "QID37") %>% pull(question_type)
#> [[1]]
#> [[1]]$type
#> [1] "MC"
#>
#> [[1]]$selector
#> [1] "SAVR"
#>
#> [[1]]$subSelector
#> [1] "TX"
Created on 2020-11-15 by the reprex package (v0.3.0.9001)
This one is a multiple choice ("MC"
).
Have you tried using fetch_survey()
with convert = FALSE
, to avoid trying to force this conversion to factors?
The output for question name == "QID56"
(the one in my example) gives the following outcome:
[[1]]
[[1]]$type
[1] "MC"
[[1]]$selector
[1] "SAVR"
[[1]]$subSelector
[1] "TX"
So it seems to be forced into a MC type as you said. I have dubbelchecked the survey in Qualtrics and the type is 'single line - text entry'.
When using the convert = FALSE
option, the warnings are not present. I quite liked the automatic conversion though :).
A text question in Qualtrics should have a question type that looks something like this:
[[1]]
[[1]]$type
[1] "TE"
[[1]]$selector
[1] "ESTB"
[[1]]$subSelector
NULL
I believe that something has gone awry with your Qualtrics survey question type, perhaps it was originally set as multiple choice and then later changed or similar? We are getting this information about the questions from the Qualtrics API itself, not anything that the R package is detecting.
Let us know if you have further problems or questions! 🙌
One of my surveys is currently giving out parsing and mutate warnings for three or four columns. The warnings look like this:
or this:
As a result, these columns remain empty (only NA's) even though several of them need to be filled. To be precise, exact those rows that are reported in the warnings.
I have identified the questions as being open ended questions (single line text entry questions). Note: other open ended questions seem to work fine.
I've tried specifying the column as.character:
However, this seemed not to be the problem.
Hopefully you are able to help me out. Thank you in advance!