Closed mattroumaya closed 3 years ago
It looks like a good reformulation of that one block of code with all the subsetting brackets. Does it include the functionality you're removing with this line x$combined_q_heading <- trimws(gsub('^\\ - NA|\\ - NA$', '', x$combined_q_heading))
?
Yes, I believe it makes that line unnecessary, because there is no longer the issue of the " - NA" appended to the end of the column names.
Ah I get it now, before it was question_type == "multiple_choice"
and now it's question_type == "multiple_choice" & is.na(other_text)
with that tighter restriction. Looks good to me then!
Thanks, @sfirke!!
I've tested this out on four separate surveys that have multiple_choice and/or multi questions with "other" fields, and seems to fix the issue by being more explicit with the
paste
call. I'm hoping this will also be easier to mend if there are additional question types added to SurveyMonkey in the future that might require additional edits.