title: Use of IF function in R
body: <p>I am running a short <code>if</code> function in R but am getting the following warning message:</p>
  
  <pre><code>In if ((runif(50, 0, 1) &lt; 0.69)) { :  the condition has length &gt; 1 and only the first element will be used`. 
  </code></pre>
  
  <p>My rudimentary grasp of R leads me to believe that <code>runif</code> generates a vector but <code>if</code> yields a single value, so I'm thinking this is the issue. Is there any simple substitution for if here?</p>
  
  <p>Also i want the end product to be a matrix combination of the two arguments but i wasn't sure if it was correct to put 50 in the <code>rnorm</code> function for both scenarios. </p>
  
  <pre><code>Test &lt;-
   if((runif(50, 0, 1)&lt;0.69)) {
   rnorm(50, 25, 4)
   } else {
   rnorm(50, 28, 4.3)
  }
  </code></pre>