I have about a dozen pickerInputs, and each time I run my shiny app, everything is set to nothing selected. I have to manually select everything before the output works which is a little annoying. Is there a way for pickerInput to default to "select all" each time the app runs?
You can use the selected argument of pickerInput. Just pass all your choices to selected, which will choose everything when the app initializes. Setting action-box option to True will also build Select All & Deselect All buttons by default, which would improve your current workflow. Here is a minimal example:
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
  pickerInput(
    inputId = "my_input",
    label = "TEST",
    choices = 1:10,    # provide choices - integers from 1 to 10
    selected = 1:10,   # select - integers from 1 to 10 
    options = list(`actions-box` = TRUE),   # build buttons for collective selection
    multiple = T
  )
)
server <- function(input, output) {}
shinyApp(ui = ui, server = server)
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With