闪亮的服务器/ UI文件无法呈现所需的输出-日志无用

时间:2018-11-26 13:45:47

标签: r shiny shiny-server

我有一个Shiny应用程序文件,如下所示。我收到错误“发生了错误。请检查您的日志或与应用程序作者联系。”我不知道怎么了。日志文件中的内容对我也没有意义:

processing file: index.Rmd
Quitting from lines 8-43 (index.Rmd) 
Warning: Error in tag: argument "label" is missing, with no default
  150: tag
  149: tags$button
  148: actionButton
  137: eval
  136: eval
  131: evaluate_call
  130: evaluate::evaluate
  129: evaluate
  127: block_exec
  126: call_block
  125: process_group.block
  122: process_file
  121: knitr::knit
  120: <Anonymous>
  115: <reactive>
   99: doc
   98: shiny::renderUI
   97: func
   84: origRenderFunc
   83: output$__reactivedoc__
    3: <Anonymous>
    1: rmarkdown::run

这是文件内容。我想有两个下拉输入,用于指定我们感兴趣的数据的哪两列。然后,我们针对这两列显示双向列联表(频率分析)。

library(shiny)

ui <- fluidPage(

  titlePanel("Frequency Analysis"),

  sidebarLayout(

    sidebarPanel(

      selectInput(inputId = "course1",
                  label = "Choose a course:",
                  choices = c("CS125", "CS173", "CS225", "CS374")),

      selectInput(inputId = "course2",
                  label = "Choose a course:",
                  choices = c("CS125", "CS173", "CS225", "CS374")),

    ),

    mainPanel(
      verbatimTextOutput("tableOut"),
      tableOutput("tableOut")

    )
  )
)

server <- function(input, output) {

  courseInput <- reactive({
    switch(input$course1,
           "CS125" = CS125,
           "CS173" = CS173,
           "CS225" = CS225,
           "CS374" = CS374
           )

    switch(input$course2,
           "CS125" = CS125,
           "CS173" = CS173,
           "CS225" = CS225,
           "CS374" = CS374
    )
  })

  output$tableOut = renderPrint({
    data = read.csv(file = 'FourCourseTableLetterGrades_POLISHED.csv', sep = '\t')
    tbl = table(data$input$course1, data$input$course2)
    tbl
  })

}

# Create Shiny app ----
shinyApp(ui, server)

0 个答案:

没有答案