title: Using "if" with "eventReactive" in shiny
body: <p>I am very new to Shiny and I am trying to build an app which retrieves data using a web service. After reading regarding "reactivity" in Shiny, I figured that "eventReactive" would be the best way to go. It worked until until there was no "if" statement but as soon as I used the "if" statement, it stopped working. Below is a simplified example of what I am trying to do-</p>
  
  <pre><code>    library(shiny)
  
  
  ui &lt;- fluidPage(
  
     # Application title
     titlePanel("Get Data"),
  
  
     sidebarLayout(
        sidebarPanel(
          textInput("stationID", "Station ID(s)", value = ""), 
          radioButtons("DownloadType", "Download",
                       choices = c("Yes","No"),
                       selected = "No"),
  
  
  
          br(),
          radioButtons("DataType", "Data Availability",
                       choices = c("All","Selected"),
                       selected = "All"),
          actionButton("goButton","Go!")
  
        ),
  
  
        mainPanel(
          (tableOutput("results"))
        )
     ))
  
  
  # Define server logic required to draw a histogram
  server &lt;- function(input, output) {
    data&lt;-eventReactive(input$goButton, {
    if(input$DataType == "All" &amp;&amp; input$DownloadType=="No"){
      employee &lt;- c('X','Y','Z')
      salary &lt;- c(100, 200, 300)
      df1&lt;-data.frame(employee, salary)
      df1
    }
  
      if(input$DataType =="Selected" &amp;&amp; input$DownloadType=="No"){
        employee &lt;- c('A','B','C')
        salary &lt;- c(100, 200, 300)
        df1&lt;-data.frame(employee, salary) 
  
        employee2&lt;-c('A','B','C')
        salary2 &lt;- c(500, 600, 700)
        df2&lt;-data.frame(employee2, salary2) 
  
        my_df&lt;-merge(df1,df2,by.x="employee",by.y="employee2")
        my_df
      }
    })
  
    output$results&lt;-renderTable({
      data()
    })
  }
  
  # Run the application 
  shinyApp(ui = ui, server = server)
  </code></pre>
  
  <p>Could someone please point me in the right direction? When the first "if" statement is true, no table is rendered. However, when the second "if" statement is true, it works. The idea is to click the "Go" button on the app to render a table based on the combination of inputs. Thank you in advance for any help.</p>