title: Reactive dropdown menu in R shiny dashboard
body: <p>new to shiny here. I am creating a dashboard and have different categories and subcategories. what I am trying to do is as follows:</p>
  
  <p>When the screen loads I would like all the categories and subcategories to be available for selection, but if I select category '1', then only 'sub1' and 'sub2' should be available for selection. So like it is being filtered by the category.
  How would I implement this in the server file in shiny?
   a brief example of my code is as follows: (server is sudo code)</p>
  
  <pre><code>UI --&gt;     
      dashboardSidebar(
          sidebarMenu(
            menuItem("CSF2", tabName = "CSF2", icon=icon("bar-chart")),
              selectInput("category", "Select a category", c("1", "2"),
              selectInput("subcategory", "Select a subcategory",       c("sub1", "sub2", "sub3" "sub4"),
          )),
  
  
  server---&gt;
  shinyServer(function(input,output){
      if (category_selected == 1){subcategoryOptions= c(sub1,sub2)}
      if (category_selected == 2){subcategoryOptions= c(sub3,sub4)}
  
  }
  </code></pre>