title: Non-standard evaluation (NSE) in dplyr's filter_ & pulling data from MySQL
body: <p>I'd like to pull some data from a sql server with a dynamic filter. I'm using the great R package dplyr in the following way:</p>
  
  <pre><code>#Create the filter
  filter_criteria = ~ column1 %in% some_vector
  #Connect to the database
  connection &lt;- src_mysql(dbname &lt;- "mydbname", 
               user &lt;- "myusername", 
               password &lt;- "mypwd", 
               host &lt;- "myhost") 
  #Get data
  data &lt;- connection %&gt;%
   tbl("mytable") %&gt;% #Specify which table
   filter_(.dots = filter_criteria) %&gt;% #non standard evaluation filter
   collect() #Pull data
  </code></pre>
  
  <p>This piece of code works fine but now I'd like to loop it somehow on all the columns of my table, thus I'd like to write the filter as:</p>
  
  <pre><code>#Dynamic filter
  i &lt;- 2 #With a loop on this i for instance
  which_column &lt;- paste0("column",i)
  filter_criteria &lt;- ~ which_column %in% some_vector
  </code></pre>
  
  <p>And then reapply the first code with the updated filter.</p>
  
  <p>Unfortunately this approach doesn't give the expected results. In fact it does not give any error but doesn't even pull any result into R. 
  In particular, I looked a bit into the SQL query generated by the two pieces of code and there is one important difference.</p>
  
  <p>While the first, working, code generates a query of the form:</p>
  
  <pre><code>SELECT ... FROM ... WHERE 
  `column1` IN ....
  </code></pre>
  
  <p>(` sign in the column name), the second one generates a query of the form:</p>
  
  <pre><code>SELECT ... FROM ... WHERE 
  'column1' IN ....
  </code></pre>
  
  <p>(' sign in the column name)</p>
  
  <p>Does anyone have any suggestion on how to formulate the filtering condition to make it work?</p>