title: Use mutate with starts_with on columns and if_else
body: <p>I have multiple Tibbles and I would like to be
  mutate them all with a function.
  The issue is that the column names are partially different:
  That is what I want to apply</p>
  <pre><code>mpg %&gt;% mutate(model_QQ = if_else(year == 1999, 0 , if_else(cty &gt; 20, 1, -1)))
  </code></pre>
  <p>But the tibbles have colnames like:</p>
  <pre><code>c(&quot;audi&quot;,&quot;nissan&quot;,&quot;subaru&quot;) %&gt;% set_names() %&gt;% map(~mpg %&gt;% rename_at(vars(model:class), list(~str_c(.,&quot;_&quot;,!!quo(.x)))))
  </code></pre>
  <p>I was thinking to make something like:</p>
  <pre><code>mpg %&gt;% mutate(model_QQ = if_else(starts_with(&quot;year&quot;) == 1999, 0 , if_else(starts_with(&quot;cty&quot;) &gt; 20, 1, -1)))
  </code></pre>
  <p>but these are working only inside the select function.
  Any suggestions?</p>
  <blockquote>
  <p>EDIT
  I remake the code with case when, maybe is made more clear that way about what I'm looking for:</p>
  </blockquote>
  <pre><code>mpg %&gt;% 
  mutate(
  model_QQ = case_when(
  
  starts_with(&quot;year&quot;) == 1999 ~ 0L,
    starts_with(&quot;cty&quot;) &gt; 20 ~ 1L,
    starts_with(&quot;cty&quot;) &lt;= 20 ~ -1L
  ))
  </code></pre>