dplyr: filter where two columns in data.frame are equal
<p>In base R one can easily filter to rows where two columns are equals like so:</p>

<pre><code>mtcars[mtcars$cyl==mtcars$carb,]
</code></pre>

<p>Using <code>dplyr</code>'s <code>filter</code> this can be done easily</p>

<pre><code>mtcars %&gt;% filter(cyl==carb)
</code></pre>

<p>But if I am writing a function using this code I would want to use <code>filter_</code>, but this code doesn't work</p>

<pre><code>mtcars %&gt;% filter_("cyl"=="carb")
</code></pre>

<p>Since in this case it thinks "carb" is a value to test rather than a variable. </p>

<p>My question is how can you use <code>filter_</code> to compare two variables in a data.frame?</p>