title: dplyr split by semi colon in case_when
body: <p>Suppose I have a dataframe <code>df</code></p>
  
  <pre><code>library(dplyr)
  df &lt;- data.frame(ID = c(1:10), Type = c('a', 'a;b','b','a','b','b','c','a;c','b;c','c'))
  </code></pre>
  
  <p>And I want to add a column called <code>color</code>, based on the values that appear in <code>Type</code>. (This is just an example, in my code there are many more variations of <code>Type</code>, i.e. <code>d;f</code>, <code>e;q</code>,<code>a;z</code> etc)</p>
  
  <pre><code>df %&gt;% 
    mutate(color = case_when(
      Type == 'a' ~ 'red',
      Type == 'b' ~ 'blue',
      Type == 'c' ~ 'green',
      TRUE        ~ as.character(Type)
    ))
  </code></pre>
  
  <p>As this stands, it returns </p>
  
  <pre><code>   ID Type color
  1   1    a   red
  2   2  a;b   a;b
  3   3    b  blue
  4   4    a   red
  5   5    b  blue
  6   6    b  blue
  7   7    c green
  8   8  a;c   a;c
  9   9  b;c   b;c
  10 10    c green
  </code></pre>
  
  <p>I am curious if there a way to split by semi-colon within the <code>case_when()</code>, in order to produce the output</p>
  
  <pre><code>   ID Type color
  1   1    a   red
  2   2  a;b   red;blue
  3   3    b  blue
  4   4    a   red
  5   5    b  blue
  6   6    b  blue
  7   7    c green
  8   8  a;c red;green
  9   9  b;c blue;green
  10 10    c green
  </code></pre>