我在我的Shiny应用中有一个checkboxGroupInput,代码如下:
checkboxGroupInput("sexe", "Sexe:",
c("Masculin" = "mas","Féminin" = "fem"))
我的问题是如何在首次加载时检查它们?
我尝试了selected=c,但没用。
使用selected = c("mas","fem")
例如
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)
choise_list=list("Masculin" = "mas", "Femenin" = "fem")
,然后使用choices = choise_list, selected = choise_list
(也许最好将此添加到答案中)。 - Batanichek