Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 条件面板不工作_R_Shiny - Fatal编程技术网

R 条件面板不工作

R 条件面板不工作,r,shiny,R,Shiny,我有一个数据框,我想在一个闪亮的应用程序中显示。我使用一些selectInput功能来对数据进行子集设置。我还想使用函数conditionalPanel仅显示部分数据。取决于所选的通道。不幸的是,我使用的方法没有显示任何表。有人有什么建议吗 希望所有括号都在正确的位置,因为我为公众稍微修改了代码 数据: 用户界面: 服务器: shinyServer(function(input, output) { output$gapminder_table_online <- renderTab

我有一个数据框,我想在一个闪亮的应用程序中显示。我使用一些
selectInput
功能来对数据进行子集设置。我还想使用函数
conditionalPanel
仅显示部分数据。取决于所选的通道。不幸的是,我使用的方法没有显示任何表。有人有什么建议吗

希望所有括号都在正确的位置,因为我为公众稍微修改了代码

数据:

用户界面:

服务器:

shinyServer(function(input, output) {

  output$gapminder_table_online <- renderTable({ 
    subset(data_test[,2:4],
           milieu == input$select_milieu & product == input$select_product)

  })

  output$gapminder_table_event <- renderTable({ 
    subset(data_test[,c(2,3,5)],
           milieu == input$select_milieu & product == input$select_product)

  })

  output$gapminder_table_ooh <- renderTable({ 
    subset(data_test[,c(2,3,6)],
           milieu == input$select_milieu & product == input$select_product)

  })

  output$output_milieu <- renderText({
    paste("milieu", input$select_milieu)
  })
  output$output_product <- renderText({
    paste("product", input$select_product)
  })
  output$output_cannel <- renderText({
    paste("cannel", input$select_cannel)
  })
})
shinyServer(功能(输入、输出){

输出$gapminder\u table\u online您的条件有输入错误(“选择\u通道”中缺少“h”),并且没有完整指定输入变量。请按如下所示更新它们,然后它将按需要工作:

...
conditionalPanel(condition = "input.select_channel == 'online'",
                           tableOutput("gapminder_table_online")),
conditionalPanel(condition = "input.select_channel == 'ooh'",
                           tableOutput("gapminder_table_ooh")),
conditionalPanel(condition = "input.select_channel == 'event'",
                           tableOutput("gapminder_table_event"))
...
但是,我觉得我应该注意到,看起来您的代码肯定还有其他问题

shinyServer(function(input, output) {

  output$gapminder_table_online <- renderTable({ 
    subset(data_test[,2:4],
           milieu == input$select_milieu & product == input$select_product)

  })

  output$gapminder_table_event <- renderTable({ 
    subset(data_test[,c(2,3,5)],
           milieu == input$select_milieu & product == input$select_product)

  })

  output$gapminder_table_ooh <- renderTable({ 
    subset(data_test[,c(2,3,6)],
           milieu == input$select_milieu & product == input$select_product)

  })

  output$output_milieu <- renderText({
    paste("milieu", input$select_milieu)
  })
  output$output_product <- renderText({
    paste("product", input$select_product)
  })
  output$output_cannel <- renderText({
    paste("cannel", input$select_cannel)
  })
})
...
conditionalPanel(condition = "input.select_channel == 'online'",
                           tableOutput("gapminder_table_online")),
conditionalPanel(condition = "input.select_channel == 'ooh'",
                           tableOutput("gapminder_table_ooh")),
conditionalPanel(condition = "input.select_channel == 'event'",
                           tableOutput("gapminder_table_event"))
...