title: Convert numeric vector to binary (0/1) based on limit
body: <p>I have a numeric vector:</p>
  <pre><code>p = c(0.69, 0.43, 0.72, 0.62, 0.29, 0.7)
  </code></pre>
  <p>I wish to compare the values to a limit, e.g. 0.5. If the values are equal or larger than the cut-off, the result should 1. Values less than 0.5 should become 0.</p>
  <p>I tried <code>ifelse</code>, but it errors:</p>
  <pre><code>newvector = rep(0, length(p))
  newvector = ifelse(p &gt;= 0.5, newvector = 1, newvector = 0)
  # Error in ifelse(p &gt;= 0.5, newvector = 1, newvector = 0) : 
  #   unused arguments (newvector = 1, newvector = 0)
  </code></pre>