mattroumaya / surveymonkey

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

Tibble error while parsing survey #65

Closed atimlaa closed 3 years ago

atimlaa commented 3 years ago

Greeting Sam/Dustin,

I am using the package to get the survey responses in data. frame as it looked very useful and resourceful. I followed all the steps as in your description but I bumped into this error while

Parsing the survey into a data.frame

survey_df <- parse_survey(a_survey_obj)

The error

Error: All columns in a tibble must be vectors. x Column heading is NULL

Any ideas on what is causing this error?

Thanks for your work!!

sfirke commented 3 years ago

Thanks for the bug report. What do you get if you try these two sub commands: x <- surveymonkey::get_responses(123456790) where the number is the ID of your survey?
y <- surveymonkey:::parse_all_questions(a_survey_obj) where that's your survey obj?

I'm betting the latter one fails? This will be tough to debug but knowing whether that would work could identify whether the problem is in the underlying function assemble or get_reponses or parse_all_questions. My guess is the error is here: https://github.com/tntp/surveymonkey/blob/master/R/question_parsers.R#L27

But I don't know what's causing it, if there's a question type or situation you have in your survey or a change to a package, etc.

atimlaa commented 3 years ago

Thanks for such a quick response, Yes you guessed right no problem in the first one but the second one fails as you expected

y <- surveymonkey:::parse_all_questions(a_survey_obj) Error: All columns in a tibble must be vectors. x Column heading is NULL.

Maybe the tibble package is the problem?? (just guessing)

sfirke commented 3 years ago

I think not, I just upgraded to tibble 3.0.4 and I can fetch my surveys okay. I am guessing it's a question type you have that I haven't encountered while programming the package, with an empty headings attribute.

If you're up for it, you can try tracing the error with traceback, see here.

If that's too complex for you but you're up for helping figure this out, I could write code that would loop through the survey questions and print which one is failing - then maybe you could tell me the details about the question (what type it is). But I won't have time for that for a while. (Also feel free to try looping through this yourself if you know how).