I am having a small problem with widgets in Shiny. After starting Shiny app I would like to have (as default) selected=NULL for all my widgets. However it is not working for numeric columns at all (factor ones are fine), and after starting i get the first value in this column. Even changing numeric to factor does not help.
My code, as example
selectInput("XX", h3("XX:"), choices = as.list(levels(as.factor(data$XY))),selected=NULL)
You can add ""
to choices
of selectInput
For example
require(shiny)
aaa=data.frame(c("a",'b','c'))
shinyUI(fluidPage(
selectInput("s1", "Select 1", choices = as.list(c("",levels(as.factor(aaa[[1]])))))
)
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.