title: Reactive Picker Input, Show Label
body: <p>I am constructing my first shiny app for which I need to have a reactive picker input. Thanks to @YBS I succeeded in building this [reactive picker input][1].</p>
  <p>However, in the picker input, instead of showing values I want to show labels. For example in the code below, instead of showing <code>year_1</code> I show the label <code>2001</code>. I want to do the same for <code>picker_cny</code>, instead of showing <code>codebook$Polygon</code>I want to show <code>codebook$Label</code> (i.e. instead of showing <code>polygon_a</code>I want to display in the picker input <code>Baron Dubois</code>).</p>
  <p>I thought about writing <code>choices = paste(c(unique(codebook$Polygon), &quot; = &quot; unique(codebook$Label)),</code></p>
  <p>Any idea? Thank you!</p>
  <p>Here is the data:</p>
  <pre><code>structure(list(X = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
  NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), Polygon = c(&quot;polygon_a&quot;, 
  &quot;polygon_a&quot;, &quot;polygon_a&quot;, &quot;polygon_a&quot;, &quot;polygon_a&quot;, &quot;polygon_a&quot;, 
  &quot;polygon_a&quot;, &quot;polygon_a&quot;, &quot;polygon_b&quot;, &quot;polygon_b&quot;, &quot;polygon_b&quot;, 
  &quot;polygon_b&quot;, &quot;polygon_b&quot;, &quot;polygon_b&quot;, &quot;polygon_b&quot;, &quot;polygon_b&quot;, 
  &quot;polygon_c&quot;, &quot;polygon_c&quot;, &quot;polygon_c&quot;, &quot;polygon_c&quot;), Label = c(&quot;Baron Dubois&quot;, 
  &quot;Baron Dubois&quot;, &quot;Baron Dubois&quot;, &quot;Baron Dubois&quot;, &quot;Baron Dubois&quot;, 
  &quot;Baron Dubois&quot;, &quot;Baron Dubois&quot;, &quot;Baron Dubois&quot;, &quot;Baron Delasalle&quot;, 
  &quot;Baron Delasalle&quot;, &quot;Baron Delasalle&quot;, &quot;Baron Delasalle&quot;, &quot;Baron Delasalle&quot;, 
  &quot;Baron Delasalle&quot;, &quot;Baron Delasalle&quot;, &quot;Baron Delasalle&quot;, &quot;Baron Istog&quot;, 
  &quot;Baron Istog&quot;, &quot;Baron Istog&quot;, &quot;Baron Istog&quot;), Year = c(&quot;year_1&quot;, 
  &quot;year_1&quot;, &quot;year_1&quot;, &quot;year_1&quot;, &quot;year_2&quot;, &quot;year_2&quot;, &quot;year_2&quot;, &quot;year_2&quot;, 
  &quot;year_1&quot;, &quot;year_1&quot;, &quot;year_1&quot;, &quot;year_1&quot;, &quot;year_2&quot;, &quot;year_2&quot;, &quot;year_2&quot;, 
  &quot;year_2&quot;, &quot;year_1&quot;, &quot;year_1&quot;, &quot;year_1&quot;, &quot;year_1&quot;), Variable = c(&quot;Variable1&quot;, 
  &quot;Variable2&quot;, &quot;Variable3&quot;, &quot;Variable4&quot;, &quot;Variable1&quot;, &quot;Variable2&quot;, 
  &quot;Variable3&quot;, &quot;Variable4&quot;, &quot;Variable1&quot;, &quot;Variable2&quot;, &quot;Variable3&quot;, 
  &quot;Variable4&quot;, &quot;Variable1&quot;, &quot;Variable2&quot;, &quot;Variable3&quot;, &quot;Variable4&quot;, 
  &quot;Variable1&quot;, &quot;Variable2&quot;, &quot;Variable3&quot;, &quot;Variable4&quot;), Value = c(1L, 
  245L, 23L, 2L, 0L, 34L, 1L, 245L, 1L, 23L, 2L, 0L, 0L, 34L, 0L, 
  34L, 0L, 34L, 90L, 9L)), class = &quot;data.frame&quot;, row.names = c(NA, 
  -20L))
  </code></pre>
  <p>Here is the code:</p>
  <pre><code># Creation of APP ------------------------------------------
  remove(ui, server)
  
  if (interactive()) {
    
    library(shiny)
    library(shinyWidgets)
    library(shinythemes)
    library(shinycssloaders)
    library(shinydashboard)  
    
  ##########
  
  # Define UI -----------------------------------------------
  ui &lt;- fluidPage(
    
    # Application title
    titlePanel(&quot;Colonial Concessions Within DRC&quot;),
    
    # Parameters
    sidebarLayout(
      sidebarPanel(
        selectInput(inputId = &quot;input_period&quot;, label = &quot;Period&quot;,
                    choices = c(&quot;2001&quot; = &quot;year_1&quot;, &quot;2002&quot; = &quot;year_2&quot;, &quot;2003&quot; = &quot;year_3&quot;)),
        pickerInput(
          inputId = &quot;picker_cny&quot;,
          label = &quot;Select Polygon&quot;,
          choices = unique(codebook$Polygon),
          options = list(`actions-box` = TRUE),
          multiple = TRUE),
        width = 2),
      
      # Displat the reactive map
      mainPanel(
        DTOutput(&quot;t1&quot;),
        width = 10)
    ))
  
  # Define Server ------------------------------------------
  server &lt;- function(input, output, session) {
    
    output$t1 &lt;- renderDT({
      # Display data only when one polygon is selected
      code1 &lt;- codebook[codebook$Year == input$input_period &amp; (codebook$Polygon %in% input$picker_cny),]
      
      code1
    })
    
    # Reactive pickerInput ---------------------------------
    observeEvent(input$input_period, {
      
      # Generate reactive picker input
      code1 &lt;- codebook[codebook$Year %in% input$input_period,]
      codeu &lt;- unique(codebook$Polygon)
      code1u &lt;- unique(code1$Polygon)
      disabled_choices &lt;- ifelse(codeu %in% code1u, 0,1)
      #print(disabled_choices)
      updatePickerInput(session = session,
                        inputId = &quot;picker_cny&quot;,
                        choices = unique(codebook$Polygon),
                        choicesOpt = list(
                          disabled = disabled_choices,
                          style = ifelse(disabled_choices,
                                         yes = &quot;color: rgba(119, 119, 119, 0.5);&quot;,
                                         no = &quot;&quot;)
                        )
      )
    }, ignoreInit = TRUE)
    
    
    
  }
  
  # Run the application
  shinyApp(ui = ui, server = server)
  }
  ``
  
    [1]: https://stackoverflow.com/questions/68994999/update-picker-input-reuse-selected-data/68999463#68999463
  </code></pre>