Tidy evaluation programming with dplyr::case_when : <p>I try to write a simple function wrapping around the dplyr::case_when() function. I read the <em>programming with dplyr</em> documentation on <a href="https://cran.r-project.org/web/packages/dplyr/vignettes/programming.html" rel="noreferrer">https://cran.r-project.org/web/packages/dplyr/vignettes/programming.html</a> but can't figure out how this works with the case_when() function. </p>

<p>I have the following data:</p>

<pre><code>data &lt;- tibble(
   item_name = c("apple", "bmw", "bmw")
)
</code></pre>

<p>And the following list:</p>

<pre><code>cat &lt;- list(
   item_name == "apple" ~ "fruit",
   item_name == "bmw" ~ "car"
)
</code></pre>

<p>Then I would like to write a function like:</p>

<pre><code>category_fn &lt;- function(df, ...){
   cat1 &lt;- quos(...)
   df %&gt;%
     mutate(category = case_when((!!!cat1)))
}
</code></pre>

<p>Unfortunately <code>category_fn(data,cat)</code> gives an evaluation error in this case.  I would like to obtain the same output as the output obtained by:</p>

<pre><code>data %&gt;% 
   mutate(category = case_when(item_name == "apple" ~ "fruit",
                               item_name == "bmw" ~ "car"))
</code></pre>

<p>What is the way to do this?</p>
