A selectizeInput customized for named vectors
Usage
vectorSelectInput(
inputId,
label,
choices,
selected = "",
...,
placeholder = "",
onInitialize
)Arguments
- inputId
passed to
selectizeInput- label
passed to
selectizeInput- choices
A named
vectorfrom which fields should be populated- selected
default selection
- ...
passed to
selectizeInput- placeholder
passed to
selectizeInputoptions- onInitialize
passed to
selectizeInputoptions
Value
a selectizeInput dropdown element
Examples
if (shiny::interactive()) {
shinyApp(
ui = fluidPage(
shiny::uiOutput("select"),
tableOutput("data")
),
server = function(input, output) {
output$select <- shiny::renderUI({
vectorSelectInput(
inputId = "variable", label = "Variable:",
data = c(
"Cylinders" = "cyl",
"Transmission" = "am",
"Gears" = "gear"
)
)
})
output$data <- renderTable(
{
mtcars[, c("mpg", input$variable), drop = FALSE]
},
rownames = TRUE
)
}
)
}
#> Error: 'interactive' is not an exported object from 'namespace:shiny'
