0
votes

Really enjoying the shinysurveys package, but cannot seem to change questions easily from the demo set, to a custom set...any ideas of how to successfully change the questions?

Tibble

library(tidyverse)
library(shiny)
library(shinysurveys)

df <- tibble(question = c("What the name of the project?",
                          "How would you describe the project? Be as Brief as possible"),
              option = c("Your Answer",
                         "Description"),
              input_type = c("text",
                             "Description"),
              input_id = c("project_name",
                           "project_description"),
              dependence = c(NA,
                             NA),
              dependence_value = c(NA,
                                   NA),
              required = c(F,
                           F)
) %>% 
  bind_rows(
    tibble(
      question = "What is the stage of the project?",
    # First multiple choice responses ---------  
      option = c("Zone1",
                 "Zone2",
                 "Zone3",
                 "Active"),
      input_type = "mc",
      input_id = "project_stage",
      dependence = NA,
      dependence_value = NA,
      required = F
    )
  ) 

UI

ui <- fluidPage(
  surveyOutput(df = df,
               survey_title = "Survey Test for lite project management application",
               survey_description = "This is a test survey for a lite file management application")
)

SERVER

server <- function(input, output, session) {
  renderSurvey(df <-  df)
  
  observeEvent(input$submit, {
    showModal(modalDialog(
      title = "Congrats, you completed your first shinysurvey!",
      "You can customize what actions happen when a user finishes a survey using input$submit."
    ))
  })
}

shinyApp(ui, server)

The error message is consistently "Error in dots_list(...) : object 'output' not found" in the ui. I do not sure what I am doing differently from the demo that is found here...https://www.jdtrat.com/packages/shinysurveys/index.html. Additional eyes, I think, will resolve the the issue I am experiencing.

I attempted changing the tibble to a data.frame, but no dice....any others thoughts and ideas would be very helpful.

2
input_type should be text in both cases - Johannes Stötzer
That was the problem. Good catch! - James Crumpler

2 Answers

0
votes

Thank you Johannes Stötzer for the comment. That was indeed the problem I was experiencing.

-1
votes

In server.R line 2, you have used the assignment operator df <- df when I think it should be the argument df = df?