Reputation: 361
I have a checkboxGroupInput in my Shiny app with the following code :
checkboxGroupInput("sexe", "Sexe:",
c("Masculin" = "mas","Féminin" = "fem"))
My question is how to have them checked when first loaded?
knowing that I've tried selected= c but didn't work
Upvotes: 4
Views: 8458
Reputation: 26258
use selected = c("mas","fem")
For example
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody( checkboxGroupInput("sexe","Sexe:",
choices = c("Masculin" = "mas", "Femenin" = "fem"),
selected = c("mas","fem")))
)
server <- function(input, output){
}
shinyApp(ui, server)
Upvotes: 9