title: Drop down menu only if checkbox ticked shiny app R
body: <p>I have a checkbox in shiny, and a <code>selectInput</code> drop down menu.</p>
  
  <p>If the checkbox is ticked, then a plot will display showing the relevant data selected from the drop down menu.</p>
  
  <p>If the checkbox is un-ticked, then the drop down menu is still visible, but the plot does not show.</p>
  
  <p>How would I change it so that the drop down menu doesn't actually appear until the box is ticked? </p>
  
  <p>An example of my code so far is something like this:</p>
  
  <pre><code>ui &lt;- fluidPage(checkboxInput(inputId = "compare",label="Load new plot?",value=F),
                  dateInput(inputId = "lowerlimit", label="Lower Date",value="2016-01-01"),
                  dateInput(inputId = "upperlimit",label="Upper Date"),
                  selectInput(inputId = "data2",label="Choose data source", choices="FILEPATHS"),
                  plotOutput("plot",dblclick = "plot_dblclick", brush = brushOpts(id="plot_brush",resetOnNew = T)))
  
  server &lt;- function(input,output,session){
  
    autoInvalidate &lt;- reactiveTimer(300000, session) #new
  
    ranges &lt;- reactiveValues(x = NULL, y = NULL)
  
    output$plot &lt;- renderPlot({
      autoInvalidate() # Load new data every 5 minutes if available.
      if(input$compare==T){
        data2=read.csv(paste0("FILEPATH",input$data2,".csv"))
  
        if (!is.null(ranges$x)) {
          ggplot(data2, aes(Date, Data, group=1))+geom_line()+
            scale_x_datetime(limits=c(ranges$x), labels = date_format("%d-%m-%y %H:%M"))
        } else {
          ggplot(data2, aes(Date, Data, group=1))+geom_line()+
            scale_x_datetime(limits=c(as.POSIXct(input$lowerlimit), as.POSIXct(input$upperlimit)), labels = date_format("%d-%m-%y %H:%M"))
        }
      }
    })
  
    observeEvent(input$plot_dblclick, {
      brush &lt;- input$plot_brush
      if (!is.null(brush)) {
        ranges$x &lt;- c(brush$xmin, brush$xmax)
        ranges$y &lt;- c(brush$ymin, brush$ymax)
  
      } else {
        ranges$x &lt;- NULL
        ranges$y &lt;- NULL
      }
    })
  
  }
  
  shinyApp(ui=ui, server=server)
  </code></pre>