How to filter a remote table based on one single value?
<p>I am doing a <code>filter()</code> using <code>%in%</code> but the way dplyr translates the query seems incorrect. In fact, the <code>%in%</code> operator works fine with more than one value, but it doesn't when only a single element is present.
In my original scenario the filtering values are dynamic, thus I would like to have a function that works in both cases.</p>

<pre><code>my_db &lt;- src_mysql(dbname = "dplyr", 
                   host = "dplyr.csrrinzqubik.us-east-1.rds.amazonaws.com", 
                   port = 3306, 
                   user = "dplyr",
                   password = "dplyr")
tbl(my_db, "dplyr") %&gt;% filter(carrier %in% c("UA","AA")) #works
tbl(my_db, "dplyr") %&gt;% filter(carrier %in% c("UA")) #doesn't work
</code></pre>

<p>My question is a duplicate of <a href="https://stackoverflow.com/questions/37591084/multiple-selectinput-values-create-unexpected-dplyr-postgres-behavior">multiple selectInput values create unexpected dplyr (postgres) behavior</a>. Seems like <a href="https://github.com/hadley/dplyr/issues/2010" rel="nofollow noreferrer">this issue</a> is well-known too </p>