【发布时间】:2018-10-22 09:42:44
【问题描述】:
我对 Shiny 和 SelectInput 函数有疑问。这是我现在的选择输入:
selectInput("top1", label = h3("TOP500"),
c("TRUE" = 1,
"FALSE" = 0,
"BOTH" = 0|1), selected = 0)
我将它用于以下功能:
filter(sales_category_id == input$top1)
这是一个被 dplyr 变异的表,最后我想在 sales_category_id 0,1 或两者之间进行选择。
有人可以帮帮我吗?这不起作用,我尝试的一切都没有给我正确的结果。
顺便提一下第一个问题,所以如果我写的东西不清楚,请告诉我:)
编辑:
由于 id 只能是 0 或 1,我以这种方式修复它:
selectInput("top1", label = h3("TOP500"),
c("TRUE" = 0,
"FALSE" = 1,
"BOTH" = 2), selected = 0)
filter(sales_category_id != input$top1
不过,我仍然对答案很感兴趣。
【问题讨论】:
-
选择输入可能不是解决此问题的最佳方法。你考虑过组复选框输入吗?
-
我确实考虑过,但我仍然不相信 selectinput 是不可能的。
标签: r filter datatable shiny dplyr