title: Writing an Indicator function in R
body: <p>I am trying to create an indictor variable, Z, in R, i.e If I have some event A, I want Z to give a result of 1 if A is true and 0 if A is false. 
  I have tried this:</p>
  
  <pre><code>Z=0
  if(A==(d&gt;=5 &amp;&amp; d&lt;=10))
    {
      Z=1
    }
    else
    {
      Z=0
    }
  </code></pre>
  
  <p>But this doesn't work. I was also thinking i could try to write a separate function called indicator:</p>
  
  <pre><code>indicator = function()
  </code></pre>
  
  <p>Any suggestions would be really helpful, thank you </p>