Measure %in% input$Severity)

问题描述 投票:0回答:1
But the moment I try to make the inputID's that I want to filter on automate, it simply won't work.

For instance:

Does nothing

Returns:

Argument 2 filter condition does not evaluate to a logical vector

Does anybody have any suggestions on how to apply a filter on many checkboxgroups?

Been pulling my hair out over this one for several days. The Shiny app I'm building opens a database which regularly gets updated. As such, values in the columns can change, and I want to make sure ...

doesn't work because input is a genuine object

"),")")

table_data <- as.data.frame(eval(parse(text=filterstatement)))table_data

inputslist <- c("input$Alliance", "input$Severity")

table_data %>% filter(Measure %in% inputslist)

Even the slightest variation will throw errors. Like if you put the "filter" command outside of the filterstatement , and only put in the list of inputs, it doesn't work. If you use table_data %>% filter( ... ), it doesn't work. Etc. 我正在构建的Shiny应用打开了一个数据库,这个数据库会定期更新。因此,列中的值可能会改变,我想确保用户可以根据这些值进行过滤。问题是:复选框需要出现在单独的框中(为了组织目的)。

inputslist2 <- c("Measure %in% input$Alliance|Measure %in% input$Severity")

table_data %>% filter(inputslist2)

所以,想象一下,用户看到的是 Severity(严重性)

[] CGI

[] GAF
r shiny shinydashboard
1个回答
0
投票

"input$Alliance"[]星级input[['Alliance']]创建这些盒子没有问题。最初,我把它们都做成了,所以选择的值都存储在 "措施 "中。问题是:你不能让多个checkboxGroupInput都向 "措施"(即input$measures)发送值并对它们进行过滤(即table_data %>% filter(Measure %in% input$measures)。

我通过给它们全部唯一的输入ID来解决这个问题。即输入$Severity ,输入$Alliance 。我能够通过手动写:table_data %>% filter(Measure %in% input$Alliancevariable name,所以不能用引号。相反,可以尝试

inputslist <- c(input[['Alliance']], input[['Severity']])
table_data %>% filter(Measure %in% inputslist)
- 这就是你如何从一个列表中动态获取对象。

0
投票

我不能告诉你为什么,但经过无休止的乱搞, 我发现这种格式是可行的。


filterstatement <- paste0("filter(table_data,",paste0("Measure %in%",inputslist,collapse=")

© www.soinside.com 2019 - 2024. All rights reserved.