R 闪亮的应用程序数据表,具有类似 excel 的过滤功能,可包含所有内容,但不包含某些元素或相反的内容

问题描述 投票:0回答:1

我想知道是否可以在 R Shiny 应用程序中拥有一个具有类似 Excel 过滤功能的输出数据表。更具体地说,我正在寻找一种方法来选择给定列中的所有元素但排除一些元素(假设我们在一列中有 100 个不同的值,并且我们只想排除其中两个)或取消选择所有值并只选择几个。 在 Excel 中,我们有一些小方框,允许我们勾选/取消勾选列中的特定值。 现在,我知道我们有了带有 MULTIPLE 参数的闪亮 selectInput:

selectInput("select_max_mdy_rtg", label = "Max Mdy Rtg", 
                                                   choices = list("Aaa" = "aaa", "Aa1"="aa1", "Aa2"="aa2", "Aa3" = "aa3", "A1"="a1","A2"="a2","A3"="a3",
                                                                  "Baa1"="baa1","Baa2"="baa2","Baa3"="baa3","Ba1"="ba1","Ba2"="ba2","Ba3"="ba3","B1"="b1","B2"="b2","B3"="b3",
                                                                  "Caa1"="caa1","Caa2"="caa2","Caa3"="caa3","Ca"="ca","C"="c","D"="d","NR/WR/NA"="na"), 
                                                   selected = 'aaa', MULTIPLE=T)

但是,这不允许我只排除几个值。 我见过类似的问题Shiny datatable filter box,但那里提出的解决方案不允许选择所有值并只排除其中的一些值,而且我不一定需要表底部的过滤器。 当过滤给定列中的值时,我需要精确地在 Excel 中执行哪些操作。 对此有何想法?

r shiny
1个回答
1
投票

您可以尝试从 ShinyWidgets 包中查找 PickerInput

例如:

pickerInput("select_max_mdy_rtg", "Max Mdy Rtg", 
                                  choices = list("Aaa" = "aaa", "Aa1"="aa1", "Aa2"="aa2", "Aa3" = "aa3", "A1"="a1","A2"="a2","A3"="a3",
                                                 "Baa1"="baa1","Baa2"="baa2","Baa3"="baa3","Ba1"="ba1","Ba2"="ba2","Ba3"="ba3","B1"="b1","B2"="b2","B3"="b3",
                                                 "Caa1"="caa1","Caa2"="caa2","Caa3"="caa3","Ca"="ca","C"="c","D"="d","NR/WR/NA"="na"), 
                                  options = list(`actions-box` = TRUE), 
                                  multiple = TRUE)
© www.soinside.com 2019 - 2024. All rights reserved.