I am trying to update a Shiny selectInput with a list of strings, some of which are quoted. If I use selectize = TRUE, the quoted strings don't appear among the choices, and if use selectize = FALSE, they do appear but cannot be selected. Can someone tell me how to solve this problem? (I have to allow for quotes since both the quoted and unquoted versions of a string may be valid choices.)
My code:
library(shiny)
runApp(list(
ui=fluidPage(
titlePanel("Problem with Selecting Quoted String"),
sidebarLayout(
sidebarPanel(
selectInput(
"chooser",
label = "Choose",
choices = "",
selectize = TRUE
)
),
mainPanel(
textOutput("text")
)
)
),
server=function(input, output, session) {
# choices <- load_choices_from_table()
choices <- c("\"APPLE\"", "APPLE", "\"BOY\"", "CAT")
updateSelectInput(session, "chooser", choices = choices)
output$text <- renderText({
paste("You chose:", input$chooser)
})
}
)
)
gsub(["],"", svec)
– IRTFM