首页 > 解决方案 > 未找到 ShinySurveys 对象“输出”

问题描述

真的很喜欢 shinysurveys 包,但似乎无法轻松地将问题从演示集更改为自定义集……关于如何成功更改问题的任何想法?

小标题

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 <- 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 <- 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)

错误消息始终是 ui 中的“dots_list(...) 中的错误:找不到对象‘输出’”。我不确定我所做的与此处的演示有何不同... https://www.jdtrat.com/packages/shinysurveys/index.html。我认为,额外的眼睛将解决我遇到的问题。

我尝试将 tibble 更改为 data.frame,但没有骰子......任何其他想法和想法都会非常有帮助。

标签: rshiny

解决方案


感谢 Johannes Stötzer 的评论。这确实是我遇到的问题。


推荐阅读