jdtrat / shinysurveys

Develop and deploy surveys in Shiny/R.
https://shinysurveys.jdtrat.com/
Other
97 stars 26 forks source link

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

Open keithomayot opened 2 years ago

keithomayot commented 2 years ago

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.

jdtrat commented 2 years ago

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

josh-marino commented 1 year ago

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 )