Reactive dataframe + reactive (user selected) column?

There are various threads about uploaded data but with given columns like this thread:

How can I call the column name of user-selected column that doesn't have a given column name? Let's say the column name is saved as input$user_selected. I can't call the column by using df()$input$user_selected or df$input$user_selected so I was wondering how this can be done.

An example for you


ui <- fluidPage(
  p("first 10 values are : "),

server <- function(input, output, session) {
  df <- reactive(iris)
  output$u_selector <- renderUI({
    df_local <- req(df())
    selectInput("user_selected","make a selection",
                selected = names(df_local)[[1]])
 output$result <- renderText({
   df_local <- req(df())
   u_sel <- req(input$user_selected)

   dfh <- head(df_local,n=10)

shinyApp(ui, server)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.