title: using conditionalPanel in Shiny ui.R and server.R: different selectInput based on a condition
body: <p>I have looked at the majority of the stackoverflow posts on using conditionalPanel in shiny and still have not been able to find my bug. </p>
  
  <p>I seem to be able to pass my parameters for "yr1" and "scen1" from server.R to ui.R, but the conditionalPanel does not appear to be working. </p>
  
  <p>In my shiny app I have two selections to be made. Depending on the first selection, a different second set of selections should be displayed.  Below is the code I am currently testing:</p>
  
  <pre><code>library(shiny)
  library(httpuv)
  
  shinyUI(pageWithSidebar(
    headerPanel("Global Temperature"),
  
    sidebarPanel(
      checkboxGroupInput("scen1", label = h3("Select 1 Map #1 Scenario"), 
                         choices = list("pre-2000" = "past", "post-2000: 850 ppm by 2100 (a2)"="a2","post-2000: 550 ppm by 2100 (b1)"="b1"), selected = "past"),
      conditionalPanel(condition = "input.scen1 == 'past'",
                       selectInput("yearspred1", "Select Map #1 Years Hindcasted",choices = c("1920-1939", "1940-1959", "1960-1979", "1980-1999"), selected="1920-1939", multiple=FALSE)),
      conditionalPanel(condition = "input.scen1 == 'a2'",
                       selectInput("yearspred1", "Select Map #1 Years Predicted",choices = c("2020-2039", "2040-2059","2060-2079", "2080-2099")), selected="2020-2039", multiple=FALSE),
      conditionalPanel(condition = "input.scen1 == 'b1'", 
                       selectInput("yearspred1", "Select Map #1 Years Predicted",choices = c("2020-2039", "2040-2059", "2060-2079", "2080-2099"), selected="2020-2039", multiple=FALSE)),
      ),
    mainPanel(
      h3(textOutput("add1")),
      imageOutput("plot1")
    )  
  
   )
  )
  </code></pre>
  
  <p>(I do the above for two selections but just show one here)</p>
  
  <p>Server.R (you would need to fill in the path for the kml options to run this):</p>
  
  <pre><code>library(shiny)
  library(httpuv)
  library(rWBclimate)
  library(ggplot2)
  
  # get temperature data for ensembles
  st=1900
  en=2100
  world &lt;- c("USA")
  options(kmlpath\="/Users/n....")
  world_map_df &lt;- create_map_df(world)
  world_dat &lt;- get_ensemble_temp(world, "annualavg", start=st, end=en)
  world_dat$data &lt;- as.numeric(as.character(world_dat$data))
  world_dat&lt;-subset(world_dat,world_dat$percentile==50) #subset to median percentile
  world_dat$years=paste(world_dat$fromYear,world_dat$toYear, sep="-")
  world_dat&lt;-subset(world_dat, select=-c(percentile, fromYear, toYear))
  
  shinyServer(function(input, output){
    scenario1&lt;-reactive({input$scen1})
    yr1&lt;-reactive({
      switch(input$yearspred1,  
             "1920-1939" = "1920-1939",
             "1940-1959" = "1940-1959",
             "1960-1979" = "1960-1979",
             "1980-1999" = "1980-1999",
             "2020-2039" = "2020-2039",
             "2040-2059" = "2040-2059",
             "2060-2079" = "2060-2079",
             "2080-2099" = "2080-2099")
    })
  
    dfyr1&lt;-reactive({subset(world_dat, world_dat$scenario==scenario1())})
    df1&lt;-reactive({subset(dfyr1(), dfyr1()$years==yr1())})
    output$add1 &lt;- renderText({paste("Temperature prediction for years ", yr1(), " and ", scenario1(), " scenario") })
  
    output$plot1&lt;- renderPlot({
      climate_map(world_map_df,df1(),return_map = T) + scale_fill_gradient2(limits=c(-20, 34), low="blue", mid="white", high = "red", space="rgb", guide="colourbar") 
    })
  })
  </code></pre>
  
  <p>Parameters are being passed, but the dropdown menu for "yr1" does not comply with the conditionalPanel conditions. I suspect it is in this part of the code, but I am not sure:</p>
  
  <pre><code>  yr1&lt;-reactive({
      switch(input$yearspred1,  
             "1920-1939" = "1920-1939",
             "1940-1959" = "1940-1959",
             "1960-1979" = "1960-1979",
             "1980-1999" = "1980-1999",
             "2020-2039" = "2020-2039",
             "2040-2059" = "2040-2059",
             "2060-2079" = "2060-2079",
             "2080-2099" = "2080-2099")
    })
  </code></pre>
  
  <p>I tried replacing it with the following line:</p>
  
  <pre><code>yr1&lt;-reactive({input$yearspred1})
  </code></pre>
  
  <p>But this did not fix the problem either.</p>
  
  <p>Thanks for any help you can provide!</p>