No default selection in selectInput in Shiny App

1,960 views
Skip to first unread message

Piyush Singh

unread,
Jun 14, 2014, 8:34:32 AM6/14/14
to shiny-...@googlegroups.com

Note: I have posted this problem on "http://stackoverflow.com/questions/24175997/no-default-select" too.

I read below lines from http://cran.r-project.org/web/packages/shiny/shiny.pdf,

" selected The value (or, if none was supplied, the title) of the navigation item that should be selected by default. If NULL, the first navigation will be selected. "

Does anybody know, what to mention if I don't want to select any value from select list? Actually my select value is getting selected by default and rest part of app is getting executed automatically. So I don't want to select any value initially. Is there any specific I need to give for select =?

====> Actually, I don't want anything to be selected automatically. I used below code but still it's selecting first available value from the list. I want it to be blank and then we can select whatever we want.

output$Choose_App <- renderUI({
selectInput("app",
            "Select App:",
            choices = as.character(mtrl_name),
            selected = NULL ,
            multiple = FALSE
           )
        })

====>I went through http://cran.r-project.org/web/packages/shiny/shiny.pdf and saw below comment. It means it can be blank only if I select multiple=TRUE. Correct me if I am wrong.

When I changed to multiple=TRUE, then it its not getting selected by default which I want but before making any selection I am getting following error message: ERROR: bad 'file' argument

Does anybody know about this if I am doing something wrong? But if I select this file then error is gone.

enter image description here

I am using following code for this:

# server.R
setwd("/opt/shiny-server/samples/sample-apps/P-Dict_RDS2")
mtrl_name <- try(system("ls | grep -i .rds", intern = TRUE))

shinyServer(function(input, output) {

# First UI input (Service column) filter clientData 
output$Choose_Molecule <- renderUI({
selectInput("molecule",
            "Select Molecule:",
            choices = as.character(mtrl_name),
            selected = input$molecule,
            multiple = TRUE
           )
        })
Reply all
Reply to author
Forward
0 new messages