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
vector
from which fields should be populated- selected
default selection
- ...
passed to
selectizeInput
- placeholder
passed to
selectizeInput
options- onInitialize
passed to
selectizeInput
options
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'