title: Shiny : Update Select Input based on Radio button Choice
body: <p>I am building a shiny app , which has two classes . Class A with categories a1,b1... , Class B with categories a2,b2 ...</p>
  
  <p>I have a radio buttons with "Class A" and "Class B"  and based on choices , I would like to update my user Input :</p>
  
  <pre><code>library(collapsibleTree)
  library(shiny)
  library(Cairo)
  library(rsconnect)
  shinyUI(fluidPage(
  titlePanel("dsfs", align="center")),
  sidebarLayout(
  sidebarPanel(
  
  
  #update selectInput based on it :
  radioButtons(inputId = "buttons", "Selections", c("class A", "Class 
  B"), 
  selected = "Class A", inline = TRUE),
  
  
  selectInput( "selection","Select a  Category ",choices = 
  "",selected="")
  
  
  ),mainPanel(
  
  
  
  diagonalNetworkOutput ("collapsiblenetwork")
  )
  
  ))
  )
  </code></pre>
  
  <p><strong>server.r</strong> </p>
  
  <pre><code>    shinyServer(
      function(session,input,output){
  
  output$collapsiblenetwork&lt;-renderDiagonalNetwork({
  
  if(input$buttons=="Class A"){
  observeEvent( 
  input$selection,updateSelectInput(session,"selection","Select a 
  category ",choices = levels(class A$categories))
      )
  
  
  user_input_value_superclass&lt;-input$selection
      print(user_input_value_superclass)
  
  # detection rate function :produces a  dataframe 
      classA_detect&lt;- 
  detecttion_rates(user_input_class_subclass_superclass = 
  user_input_value_superclass,user_input_shiny_header ="Class A" )
      ClassA_superclass&lt;-as.Node(ClassA_detect)    
  
      useRtreeList &lt;- ToListExplicit(ClassA_superclass, unname = TRUE)
      network_plot&lt;-diagonalNetwork( useRtreeList)
  
  
    }else if(input$buttons=="Class B") {
  
  
      observeEvent( 
     input$selection,updateSelectInput(session,"selection","Select a 
     category ",choices = levels(classB$categories))
      )
  
      user_input_value_subclass&lt;-input$selection
     ClassB_detect&lt;-detecttion_rates(user_input_class_subclass_superclass 
      = user_input_value_subclass,user_input_shiny_header = "Class B")
  
      ClassB_subclass&lt;-as.Node(ClassB_detect)    
  
      useRtreeList &lt;- ToListExplicit(ClassB_subclass, unname = TRUE)
      diagonalNetwork( useRtreeList)
  
  
  
    }   
  
  
  })
  
  
  })
  </code></pre>
  
  <p>The code Produces , the radio buttons and the selection inputs accordingly , but as soon as I select a input other than the default input value ,for that class , the plot  for the new selection is plotted for a split second automatically renders back  to the original plot (i.e default selection).
  Everything else works fine .
  I tried printing the input after updating the select input , it produces an empty string "". 
  Apologies for the long script.
  Thanks!</p>