【问题标题】:R Shiny dataTableOutput all if not brushedR Shiny dataTableOutput all if not brushed
【发布时间】:2018-02-12 16:33:21
【问题描述】:

我在服务器应用程序的 R Shiny App 中有一个 renderDataTable 对象,它显示了用户在散点图中刷出的那些游戏的所有标题,并将它们显示在带有更多统计信息的数据表中。

  output$dtable <- renderDataTable({ 
    brushedPoints(daten(), input$brush_plot) %>% na.omit()
    %>% select(GAME.NAME,input$x, input$y)
    })
  }

现在,我想默认显示所有游戏,如果用户不刷剧情的话。 我想我必须在 renderDataTable 函数的开头使用 if-else 分支,但我不知道要传递哪些参数.. 我已经尝试过if (!input$brush_plot)if(!brushedPoints()) .. 然后(daten()%&gt;% select..) 但这没有用.. 我怎样才能做到这一点?

【问题讨论】:

  • 我想你要检查一下:if (length(input$brush_plot) &gt; 0)
  • 是的,谢谢,这正是我要找的 :) if (length(input$brush_plot)==0) { daten() } else {brushedPoints(daten(), input$brush_plot) %>% na.omit() %>% select(GAME.NAME,input$x, input$y)} })

标签: shiny


【解决方案1】:

我想你想检查一下:

if (length(input$brush_plot) > 0) {
    daten()
} else {
    brushedPoints(daten(), input$brush_plot) %>%
    na.omit() %>%
    select(GAME.NAME,input$x, input$y)
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-24
    • 2015-11-13
    • 1970-01-01
    • 2015-11-15
    • 2022-12-01
    • 1970-01-01
    • 2017-09-09
    • 2018-04-19
    相关资源
    最近更新 更多