Some one can help me to fix this function code? : <p>i want to use a function for each row in a vector.</p>

<p>when I try my code I receive this message:
the condition has length > 1 and only the first element will be used</p>

<pre><code>function(Inn, x, y, z, xx, b, i, Dp){

  if (Inn == 0) {
    if (runif(1) &lt;= x) { # success.probability.imitation 
      absorptive.capacity &lt;- max(y, z) 
    }
    else{
      absorptive.capacity &lt;- min(x, x + b/sqrt(i) - Dp)
    } 
  } else{
    if (runif(1) &lt;= xx) { # sucess innovation
      absorptive.capacity &lt;- y + b / sqrt(i)
    } else{
      absorptive.capacity &lt;- y + b / sqrt(i) - Dp
    }

  }
  if (absorptive.capacity &gt; 1) {
    absorptive.capacity = 1
  }
  return(absorptive.capacity) 
}

absorptive.capacity(c(0, 1), c(0.5, 0), c(0.7, 0.8), 0.7, c(0, 06), 0.5, c(64, 94), 0.06)
</code></pre>

<p>I want return each value after that transformation, this is the purpose for my function. Some one can help me?</p>
