title: How to separate multiple choice phrases (Google Forms) in different columns?
body: <p>I saw that there are some topics on this issue (<a href="https://stackoverflow.com/questions/44109108/r-how-to-separate-multiple-choice-multiple-answers-questionnaire-data-that-goo">here</a> and <a href="https://stackoverflow.com/questions/24938616/string-split-on-last-comma-in-r">here</a>), but in both cases the examples were with multiple comma-delimited choices. In this case it is a little different.</p>
  <ol>
  <li>In my survey, there were options to select multiple phrases (to make it difficult, some of them contain commas)</li>
  <li>There is an &quot;Other reasons&quot; option, in which respondents could write their own sentences.</li>
  <li>Each sentence starts with a capital letter (and there are no other capital letters in the middle of the sentence). Except the &quot;other reasons&quot; options, which can start with a lowercase letter depending on how the respondent wrote.</li>
  </ol>
  <p>The list of predefined choices is registered as follows:</p>
  <pre><code>Q1.list &lt;- c (&quot;Phrase one without comma&quot;, &quot;Phrase two also without comma&quot;, &quot;Phrase three, with comma&quot;)
  </code></pre>
  <p>The database looks like this:</p>
  <pre><code>Q1
  &quot;Phrase one without comma, Phrase two also without comma&quot;
  &quot;Phrase two also without comma, Phrase three, with comma&quot;
  &quot;Phrase three, with comma, Phrase four, other reasons&quot;
  &quot;Phrase one without comma, Phrase four, other reasons, Phrase five other reasons&quot;
  </code></pre>
  <p>And I would like to transform the data set in this way:</p>
  <pre><code>Q1.1          Q1.2          Q1.3          Others
  1             1             0             0
  0             1             1             0
  0             0             1             &quot;Phrase four, other reasons&quot;
  1             0             0             &quot;Phrase four, other reasons, Phrase five other reasons [and everything else that is not on the Q1.list]&quot;
  </code></pre>
  <p>Could someone shed light on how to solve this problem?</p>