mattroumaya / surveymonkey

Access your SurveyMonkey data directly from R!
https://mattroumaya.github.io/surveymonkey/
Other
42 stars 10 forks source link

parse_survey: (a) unique id creation; (b) arranging final 'out' object by response_id #78

Closed wnfaulkner closed 2 years ago

wnfaulkner commented 3 years ago

Hello @mattroumaya,

I've now gotten my own version of parse_survey() working for one of the client's surveys. I have not yet tested it on others. Although I do not have a full, professional diagnosis of the errors I've been getting, I wanted to at least present them to you with the solutions I found.

(a) unique_id creation

wnfaulkner commented 3 years ago

Line 64-67 of file 'assemble.r': with my survey, there were no NAs in x$q_unique_id but the left side of the command x$q_unique_id[x$question_type == "multiple_choice" | x$question_subtype == "multi" & is.na(x$other_id)] returned a vector with a bunch of NAs and hence threw an error. I solved this by putting parentheses around the conditions on both left and right sides of the command so now it reads:

x$q_unique_id[(x$question_type == "multiple_choice" | x$question_subtype == "multi") & is.na(x$other_id)] <- paste( x$q_unique_id[(x$question_type == "multiple_choice" | x$question_subtype == "multi") & is.na(x$other_id)], x$choice_id[(x$question_type == "multiple_choice" | x$question_subtype == "multi") & is.na(x$other_id)], sep = "_" )

(b) arranging final 'out' object by respons_id Lines 152-154 of file 'assemble.r':

Now the command reads: `out %<>%

dplyr::arrange(dplyr::desc(response_id)) %>%

      #dplyr::rename(respondent_id = response_id)
      ReplaceNames(., current.names = "response_id", new.names = "respondent.id") %>%
      ReplaceNames(., current.names = "", new.names = ".")`

Hope this is helpful. I cannot share my data, but I would be happy to continue to work on further investigations if desired!

Best @wnfaulkner

mattroumaya commented 3 years ago

Thanks for the detailed information @wnfaulkner! I'm not able to find a survey that is in use for my account that has this same issue, so it makes troubleshooting it more difficult.

Totally understandable that you cannot share your data. If it's possible to share the survey question types, or an overview of how the survey is set up, then I could try to set up a similar survey with dummy data to recreate the issue on my end. For instance, if you're using A/B testing with images, or some of the less popular question types, that could be one reason why this is happening.

I'll have more time next week to dive into this, but thanks again for the info you've provided!

mattroumaya commented 2 years ago

@wnfaulkner closing for now but feel free to reopen if needed.