title: Can ifelse be used effectively with outputs that have no return?
body: <p>Consider the following example code:</p>
  
  <pre><code>b&lt;-0
  plot(0,0)
  ranVec&lt;-runif(100)
  f1&lt;-function()#ran 40% of the time
    {
      b&lt;-b+1
      points(b,4)
    }
  f2&lt;-function()#ran 60% of the time
    {
      b&lt;-b-1
      points(b,4)
    }
  </code></pre>
  
  <p>I'm currently dealing with something very similar and my next line of code is effectively:</p>
  
  <pre><code>for(i in 1:100)
  {
     if(ranVec[i]&lt;=0.4) f1
     else f2
  }
  </code></pre>
  
  <p>But would it have been possible to achieve this previous block's outcome with <code>ifelse</code>? For example, what I really wanted to write was:</p>
  
  <pre><code>ifelse(rawResults&lt;=0.4, f1, f2)
  </code></pre>
  
  <p>But this throws an error presumably concerning the length of the output.</p>