title: How to make related server-side selectize UI elements in R Shiny application?
body: <p>I have R Shiny application with two UI selectors where each one has a big list of items. I know how to make server-side element for one element. But how to make two related server-side 'selectInput' elements. So, when exist a change in one element - another should reflect appropriately.</p>
  
  <p>Example.</p>
  
  <ol>
  <li><p>The first list has 97,310 elements.</p></li>
  <li><p>The second list should have:</p></li>
  </ol>
  
  <p>2.1. for 1st element "Aaban" - 2 related values (10, 11)</p>
  
  <p>2.2. for 2nd element "Aabha" - 1 related value (12)</p>
  
  <p>2.3. for 3rd element "Aabid" - 3 related values (13, 14, 15)</p>
  
  <p>Here is R code.</p>
  
  <pre><code>library(shiny)
  library(dplyr)
  library(babynames)
  
  # 1. Data sets
  
  # 1.1. First data set (list)
  list_names &lt;- babynames::babynames %&gt;% 
    distinct(name) %&gt;%
    pull(name) %&gt;%
    sort()
  
  # 1.2. Second data set (data frame) for 3 first 'names' elements
  df_ages &lt;- data.frame(
    name = c("Aaban", "Aaban", "Aabha", "Aabid", "Aabid", "Aabid"),
    age  = c(10, 11, 12, 13, 14, 15))
  
  # 2. UI
  ui &lt;- fluidPage(
    fluidRow(selectInput("si_name", "Name", multiple = FALSE, choices = character(0))),
    fluidRow(selectInput("si_age", "Age", multiple = FALSE, choices = character(0))))
  
  # 3. Server
  server &lt;- function(input, output, session) {
    updateSelectizeInput(session, "si_name", choices = list_names, server = TRUE)
    updateSelectizeInput(session, "si_age", choices = df_ages$age, server = TRUE)
  }
  
  # 4. App
  shinyApp(ui, server)
  </code></pre>
  
  <p>Thanks!</p>