title: How to create IF statement with reactive values in R ( Shiny )
body: <p>Beginner to R and shiny here!
  Tried to make a minimal working example... I want to check a condition on a reactive input value. What am I doing wrong?</p>
  
  <pre><code>library(shiny)
  
  ui&lt;-fluidPage(
  
    numericInput(inputId="a", label=NULL, value=0),
    textOutput(outputId="out")
  )
  
  server &lt;- function(input, output) {
    x &lt;- reactive(input$a)
    if (x() &lt; 4) 
      {y&lt;-1}
    else
    {y&lt;-0}
  
    output$out &lt;- renderText({y})
  }
  
  shinyApp(ui = ui, server = server)
  </code></pre>
  
  <p>The error message: </p>
  
  <blockquote>
    <p>Operation not allowed without an active reactive context. (You tried
    to do something that can only be done from inside a reactive
    expression or observer.)</p>
  </blockquote>