I want the selectInput to show "Option1" and "Option2" not "1" and "2".
server.R
library(shiny)
shinyServer(function(input, output) {
## Uncomment one of the below options (single #)
## This option works but the data.frame only has 1 level, mine has 20 levels
#my_list <- as.character(c("Option1","Option2"))
## This option does not work and is as close as I can get to recreating my error
#my_list <- data.frame(c("Option1","Option2"))
## This option does not work as ds has Factor w/ 20 levels, 20 obs. of 1 variable
#ds <- getData()
#ds <- data.frame(ds)
#my_list <- as.character(c(ds))
output$my_list_select <- renderUI({
selectInput(inputId = "select_input1",
label = h6("My List"),
choice = (my_list),
selected = 2)
})
})
ui.R
library(shiny)
shinyUI(
fluidPage(
mainPanel(
fluidRow(
column(4,
uiOutput("my_list_select")
)))))
Edition:
At agstudy's suggestion I have rewritten the above so that it is as reproducible as possible ( I have a MYSQL query running on a local DB in getData()
so what I can reproduce is limited).
Thanks for your time.