例如,我有一个闪亮的应用程序
library(shiny)
ui <- fluidPage(
checkboxGroupInput("checkboxname",
label = "name",
choices = list("Mary" = "Mary",
"Tom" = "Tom",
"John" = "John",
"Kevin" = "Kevin",
"Rebecca" = "Rebecca"),
selected = "Mary"),
plotOutput(outputId = "plot")
)
server <- function(input, output) {
output$plot<- renderPlot({
dt <- dt[name %in% input$checkboxname]
})
}
shinyApp(ui, server)
我可以根据复选框过滤数据框数据。
现在,我还有其他数据框
x=data.frame(Name=c("Mary","Tom","John","Kevin","Rebecca","Tom","Kevin"),
Grade=c("90","68","55","59","70","88","15"))
我想将ui复选框的名称更改为此x数据框的名称
这样的ui视图
□Mary
□Tom
□John
□Kevin
□Rebecca
□Tom
□Kevin
但是不能失去原始的过滤功能
数据框数据每次都不同。
所以,我不知道该怎么做。