title: What's the tidyeval approach of using dplyr::filter with a database when condition is specified as string?
body: <p>I can't figure out how to use <code>dplyr::filter</code> with a database when condition is specified as string. <code>dplyr::filter_</code> is easy here but is deprecated.</p>
  
  <pre class="lang-r prettyprint-override"><code>suppressPackageStartupMessages(library(dplyr))
  con &lt;- DBI::dbConnect(RSQLite::SQLite(), dbname = ":memory:")
  copy_to(con, iris, "iris", temporary = FALSE)
  iris_db &lt;- tbl(con, "iris")
  filter_str &lt;- "Species == 'setosa'"
  </code></pre>
  
  <p>First try filtering on a dataframe</p>
  
  <pre class="lang-r prettyprint-override"><code>iris_db %&gt;% collect() %&gt;% filter(eval(parse(text = filter_str))) %&gt;% count()
  #&gt; # A tibble: 1 x 1
  #&gt;       n
  #&gt;   &lt;int&gt;
  #&gt; 1    50
  </code></pre>
  
  <p>Now try this on the database using <code>filter_</code></p>
  
  <pre class="lang-r prettyprint-override"><code>iris_db %&gt;% filter_(filter_str) %&gt;% collect() %&gt;% count()
  #&gt; Warning: filter_() is deprecated. 
  #&gt; Please use filter() instead
  #&gt; 
  #&gt; The 'programming' vignette or the tidyeval book can help you
  #&gt; to program with filter() : https://tidyeval.tidyverse.org
  #&gt; This warning is displayed once per session.
  #&gt; # A tibble: 1 x 1
  #&gt;       n
  #&gt;   &lt;int&gt;
  #&gt; 1    50
  </code></pre>
  
  <p>Now try this on the database using <code>filter</code>. This fails.</p>
  
  <pre class="lang-r prettyprint-override"><code>iris_db %&gt;% filter(eval(parse(text = filter_str))) %&gt;% collect() %&gt;% count()
  #&gt; Warning: Named arguments ignored for SQL parse
  #&gt; Error: near "AS": syntax error
  </code></pre>
  
  <p>And this is why it fails </p>
  
  <pre class="lang-r prettyprint-override"><code>iris_db %&gt;% filter(eval(parse(text = filter_str))) %&gt;% show_query() 
  #&gt; &lt;SQL&gt;
  #&gt; Warning: Named arguments ignored for SQL parse
  #&gt; SELECT *
  #&gt; FROM `iris`
  #&gt; WHERE (eval(parse('Species == ''setosa''' AS `text`)))
  </code></pre>
  
  <p><sup>Created on 2020-03-26 by the <a href="https://reprex.tidyverse.org" rel="nofollow noreferrer">reprex package</a> (v0.3.0)</sup></p>