shinysurveys icon indicating copy to clipboard operation
shinysurveys copied to clipboard

Error: $ operator is invalid for atomic vectors Called from: getSurveyData()

Open keithomayot opened this issue 3 years ago • 2 comments

Hi, Firstly, I love the shinysurveys package. It's been a really important implementation in R programming.

I've implemented a matrix input for a survey question and on calling the responses with getSurveyData() an error occurs. I think it's in the way the function tries to access elements in the matrix. The elements in a matrix should be accessed using square-brackets ( [ ] ) in R. I think this is the fix to the issue.

keithomayot avatar Dec 01 '21 12:12 keithomayot

Hi! Thanks! Can you provide a small reprex please (specifically a data frame of questions that will trigger this error)?

jdtrat avatar Dec 01 '21 12:12 jdtrat

Here is one that reproduces the error. I think any df with a matrix input. Hopefully a quick fix. Try this with your existing ice cream example.

ice_cream_question <- data.frame( question = "Question 1", option = c("Disagree", "Neutral", "Agree"), input_type = "matrix", input_id = "matId", dependence = NA, dependence_value = NA, required = TRUE )

josh-marino avatar Mar 07 '23 17:03 josh-marino