I want to use the input to select the variable in the dataframe and unique it to get a vector.
But it's not work.
library(shiny)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
selectInput("variable", "Variable:",colnames(iris))
),
mainPanel(
textOutput("table")
)
)
)
server <- function(input, output) {
output$table <- renderText({
a <- unique(iris$input$variable])
})
}
# Run the application
shinyApp(ui = ui, server = server)