Reputation: 3760
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)
Upvotes: 0
Views: 376
Reputation: 7871
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]])))))
)
)
Upvotes: 4