title: Countif with multiple criterias in R
body: <p>I would like to count all rows where two criterias are matched. My approach was: </p>
  
  <pre><code>a &lt;- c(2,1,2,2,3,4,2,1,9)
  b &lt;- c(2,1,2,1,4,4,5,6,7)
  c &lt;- data.frame(a,b)
  sum((c['a']==2) &amp;&amp; (c['b']==2))
  </code></pre>
  
  <p>but for some reason this gives 1 instead of two. How could I count rows if multiple criterias are matched?</p>