【发布时间】: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()%>% select..) 但这没有用..
我怎样才能做到这一点?
【问题讨论】:
-
我想你要检查一下:
if (length(input$brush_plot) > 0) -
是的,谢谢,这正是我要找的 :) if (length(input$brush_plot)==0) { daten() } else {brushedPoints(daten(), input$brush_plot) %>% na.omit() %>% select(GAME.NAME,input$x, input$y)} })
标签: shiny