Suppose I have in my shiny ui.R an input:
selectInput("choice","Select Values",choices=c('a','b','c',FALSE),
selected="FALSE")
And I want to use this input as a parameter to a function in server.R. The default value for this parameter is FALSE, but can take in character values. I want to set it so that, for example, if the user select 'a', the value 'a' would be passed on to the parameter in the function, and if the user select 'FALSE', the default value of FALSE is passed on to the parameter.
The way I tried to do this is by:
choice <- ifelse(input$choice=='FALSE',FALSE,input$choice)
and then use it in the function:
sample_func(param=choice)
However, this gives me an error "param has the wrong format". The error is the result of choice not being a character value or FALSE.
What might be the reason for this?
sample_funchandles its input?ifelseis tricky with vectors, you will get one value back per comparison