ui <- fluidPage(
checkboxInput(inputId = "hide_show_checked", label = "Hide/Show all checked checkbozes"),
checkboxGroupInput(inputId = "Check1",
label = h4("Fish:"),
choices = c("Bass", "Shark", "Tuna")),
verbatimTextOutput("value")
)
server <- function(input, output, session) {
output$value <- renderPrint({ input$Check1})
observe({
if(input$hide_show_checked) {
#x <- ifelse(data %in% c("Bass", "Shark", "Tuna"), data, "NA")
data <- isolate(input$Check1)
y <- c("Bass", "Shark", "Tuna")
x <- y[!y %in% data]
#y[-match(data,y)] OR setdiff(data,y)
updateCheckboxGroupInput(session, "Check1",label = paste("Checkboxgroup label", length(x)),choices = x,selected = x)
} else {
updateCheckboxGroupInput(session, "Check1",label = "Checkboxgroup label", choices = c("Bass", "Shark", "Tuna"),selected = NULL)
}
})
}
shinyApp(ui, server)
Надеюсь, это поможет;)