如何在闪亮的

时间:2015-06-22 15:58:28

标签: r shiny

我使用drop box显示三个选项,

selectInput("select", label = h5("Choose Annotation DB"),
                                          choices = list("h10kcod.db"="h10kcod","h20kcod.db"="h20kcod","hwgcod.db"="hwgcod")),
                                       selected = NULL)

但是它总是在已经选中的下拉框中有第一个选择,但是我有兴趣让下拉框为空(没有选中)。我该怎么做感谢

1 个答案:

答案 0 :(得分:4)

你好看这个例子:

library("shiny")

ui = fluidPage(
  # method 1 : put an empty element "" in your list
  selectInput("select", label = h5("Choose Annotation DB"),
              choices = list("",     "h10kcod.db"="h10kcod","h20kcod.db"="h20kcod","hwgcod.db"="hwgcod")),
  # method 2 : use selectizeInput and the placeholder option
  selectizeInput("select", label = h5("Choose Annotation DB"),
          choices = list("h10kcod.db"="h10kcod","h20kcod.db"="h20kcod","hwgcod.db"="hwgcod"),
          options = list(placeholder = 'A placeholder',
                         onInitialize = I('function() { this.setValue(""); }')))
)

server = function(input, output) {

}

shinyApp(ui = ui, server = server)