mattroumaya / surveymonkey

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

Make sure parse_all_questions won't choke if a question type wasn't used on survey #25

Closed sfirke closed 5 years ago

sfirke commented 5 years ago

Some columns may not naturally be present after parsing the questions, e.g., other_text may be missing if there were no "other" options offered. Force those to be present (NA values) to keep subsequent code running.

In trying out my current working code on random surveys, I surfaced a need for col_text and other_text so added this below. Check to see if other shortcomings could need to be addressed.

cols_to_require <- c("col_text", "other_text")
  add <- cols_to_require[!cols_to_require %in% names(out_q)]
  if(length(add) != 0) out_q[add] <- NA_character_