title: R - check whole vector in if clause
body: <p>here is a little example:</p>
  
  <pre><code>foo &lt;- 1:5
  foo &lt; 6
  &gt; TRUE TRUE TRUE TRUE TRUE
  if(foo &lt; 6) {   # if(foo[1]&lt;6 &amp; foo[2]&lt;6 &amp; foo[3]&lt;6 ...
    # do something
  }
  </code></pre>
  
  <p>And I need a if-claus if 3 elements are true (order is not important), e.g.</p>
  
  <pre><code>bar &lt;- c(1,3,6,8,2)
  if(bar &lt; 5) {   # if 3 values are true
     # do something
  }
  </code></pre>
  
  <p>Thx for help.</p>