Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing response gives getSurveyData error #51

Open
drgaryhb opened this issue Jun 3, 2022 · 1 comment
Open

Missing response gives getSurveyData error #51

drgaryhb opened this issue Jun 3, 2022 · 1 comment

Comments

@drgaryhb
Copy link

drgaryhb commented Jun 3, 2022

Hi Jonathan

First, thank you for Shinysurveys - it's great! I hope you can help with this!

I have a matrix of n questions and 5 radio buttons per questions, created using the code below. Instead of hard-coding the questions it reads from a database file so I can change the number of questions, response intervals etc.

Code is attached

It works great if all buttons are checked but...

If a radio button is not checked then it is a missing value in the getSurveyData() dataframe (code below) which throws an error message: "Warning: Error in data.frame: arguments imply differing number of rows: 1, 0"

As I understand it, getSurvey() returns a data frame/tibble where missing values will create a dataframe with columns of uneven length, hence i.e. a value is not inserted in to row... "differing number of rows: 1, 0"

So...
Q.1 How can I prevent the error / uneven col lengths? Or insert an NA or arbitrary value such as 999?

Q.2 Is there a method to check that all questions are answered, a. immediately when a response is missed and b. of checking all responses when the submit button is clicked?

Thank you in advance,

Kind regards

Gary

app.txt

@cwilligv
Copy link

Hey @drgaryhb , how did you solve this? I'm facing a similar challenge with my questions using a matrix. Each question has 4 options and user can select only 2 out of the 4 options, no more no less. When I select only 2 I get the same error you're describing. Would be great to know how you solved it.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants