mattroumaya / surveymonkey

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

Combine question and answer choice data as they are pulled, to make true unique ID #21

Closed sfirke closed 5 years ago

sfirke commented 5 years ago

Question 1715092755. It pains me to say this but given that question and choice data live in the same lists, it may be cleaner in the long run to scrap the current separate parsers and instead write a single unified one, likely merging/expanding them appropriately as it goes.

sfirke commented 5 years ago

True unique question ID - for the purpose of ultimately being a column in a data.frame - is question_id x col_id (if applicable) x row_id (if applicable). I guess maybe also x other_id as well because it's its own column.

On the response parsing side, parse_response does pull all of these for an individual response, though it will have to be manipulated differently in parse_respondent_list.

Right now, col_id is not pulled in question/answer parsing.

> respondents[[99]]$pages[[9]]$questions[[2]] %>% parse_answers()
# A tibble: 6 x 4
  col_id     choice_id  row_id     question_id
  <chr>      <chr>      <chr>      <chr>      
1 1715092755 1715092763 1715092754 252624807  
2 1715092756 1715092768 1715092754 252624807  
3 1715092757 1715092774 1715092754 252624807  
4 1715092755 1715092762 1715092758 252624807  
5 1715092756 1715092768 1715092758 252624807  
6 1715092757 1715092774 1715092758 252624807