title: Creating dummy variables from character string
body: <p>I've been provided with a rather awkward character string that looks as follows</p>
  <pre><code>TestData &lt;- tibble(c(&quot;Pepper|Salt|Apple|Pear&quot;,&quot;Pepper|Salt|Apple&quot;, &quot;Apple|Pear&quot;, &quot;Fruit&quot;, &quot;Pepper|Fruit&quot;))
  Names &lt;-c(&quot;Test&quot;)
  names(TestData) &lt;- Names
  </code></pre>
  <p>I would like to create a dummy variable/ new column for each word, such as &quot;Pepper&quot; in the character string where 1 indicates the presence of the word and 0 indicates its absence. I'm not entirely sure how to split them out and create a new variable for each. Any help that people can offer would be greatly appreciated!</p>
  <p>Thank you in advance</p>