select(ize)输入不显示Shiny中的初始值

时间:2015-10-14 16:39:17

标签: r shiny

我正在尝试在Shiny中显示值的下拉列表。但是它似乎没有显示初始值。

 selectizeInput('id', label = "Year", choices =  
 NULL, multiple=FALSE,selected="X2015",                                             options = list(create = 
TRUE,placeholder = 'Choose year'))

 year <- c("X2001","X2002","X2003","X2004","X2005","X2006","X2007","X2008",
      "X2009","X2010","X2011","X2012","X2013","X2014","X2015","X2016",
      "X2017","X2018")                                        

  updateSelectizeInput(session, 'id', choices = year, server = TRUE)   

1 个答案:

答案 0 :(得分:0)

在updateSelectizeInput中添加所选参数可设置默认值

  updateSelectizeInput(session, 'id', choices = year, server = TRUE,selected="2001")