title: Error: Each row of output must be identified by a unique combination of keys. Keys are shared for 2 rows: when using Unnest_token and spread
body: <p>This is the data frame I'm working with</p>
  <pre><code># A tibble: 268 x 5
     Horodateur          Gender Age     Time    Social                                
     &lt;dttm&gt;              &lt;chr&gt;  &lt;chr&gt;   &lt;chr&gt;   &lt;chr&gt;                                 
   1 2021-04-23 09:59:16 Male   [18,24[ 1-5 ho~ Facebook, Instagram, Twitter, Snapcha~
   2 2021-04-23 10:11:35 Female [10,18[ 1-5 ho~ Reddit                                
   3 2021-04-23 10:18:24 Male   [18,24[ &gt;10 ho~ Facebook, Instagram, Twitter, Linkedi~
   4 2021-04-23 10:42:28 Female [18,24[ 5-10 h~ Facebook, Instagram, Twitter, Snapchat
   5 2021-04-23 10:42:37 Female [18,24[ 5-10 h~ Facebook, Instagram, TikTok, Snapchat 
   6 2021-04-23 10:45:35 Female [24,34[ 1-5 ho~ Facebook, Instagram, Twitter, Linkedi~
   7 2021-04-23 10:48:09 Male   [18,24[ 5-10 h~ Facebook, Instagram, TikTok, Linkedin~
   8 2021-04-23 10:49:56 Male   [18,24[ 5-10 h~ Facebook, Instagram, Snapchat         
   9 2021-04-23 10:50:39 Male   [24,34[ 0 hours Linkedin, Reddit                      
  10 2021-04-23 10:51:36 Male   [18,24[ 5-10 h~ Facebook, Instagram, Twitter, TikTok  
  # ... with 258 more rows
  &gt; str(Survey[1:5])
  tibble [268 x 5] (S3: tbl_df/tbl/data.frame)
   $ Horodateur: POSIXct[1:268], format: &quot;2021-04-23 09:59:16&quot; &quot;2021-04-23 10:11:35&quot; ...
   $ Gender    : chr [1:268] &quot;Male&quot; &quot;Female&quot; &quot;Male&quot; &quot;Female&quot; ...
   $ Age       : chr [1:268] &quot;[18,24[&quot; &quot;[10,18[&quot; &quot;[18,24[&quot; &quot;[18,24[&quot; ...
   $ Time      : chr [1:268] &quot;1-5 hours&quot; &quot;1-5 hours&quot; &quot;&gt;10 hours&quot; &quot;5-10 hours&quot; ...
   $ Social    : chr [1:268] &quot;Facebook, Instagram, Twitter, Snapchat, Reddit, Signal&quot; &quot;Reddit&quot; &quot;Facebook, Instagram, Twitter, Linkedin, Snapchat, Reddit, Quora&quot; &quot;Facebook, Instagram, Twitter, Snapchat&quot; ...
  </code></pre>
  <p>I'm trying to split the Social column to get something like this</p>
  <pre><code>      Id Facebook Instagram Reddit Signal Snapchat TikTok Twitter
     &lt;int&gt; &lt;chr&gt;    &lt;chr&gt;     &lt;chr&gt;  &lt;chr&gt;  &lt;chr&gt;    &lt;chr&gt;  &lt;chr&gt;  
   1     1 No       No        No     No     No       No     Yes    
   2     2 Yes      Yes       No     No     Yes      No     Yes    
   3     3 No       Yes       No     Yes    No       Yes    No     
   4     4 No       Yes       No     No     Yes      No     No     
   5     5 No       Yes       No     Yes    Yes      Yes    Yes    
   6     6 No       Yes       No     No     No       No     No     
   7     7 No       No        Yes    Yes    No       Yes    Yes    
   8     8 No       No        Yes    No     No       No     Yes    
   9     9 No       No        Yes    No     Yes      Yes    No     
  10    10 No       Yes       Yes    Yes    Yes      No     Yes
  </code></pre>
  <p>So wrote this code</p>
  <pre><code>Survey %&gt;%
    mutate(Id = row_number(), HasAccount = &quot;Yes&quot;) %&gt;%
    unnest_tokens(Survey, Social, to_lower = F) %&gt;%
    spread(Survey, HasAccount, fill = &quot;No&quot;)
  
  </code></pre>
  <p>But I get the error mentioned in the title</p>
  <pre><code>Error: Each row of output must be identified by a unique combination of keys.
  Keys are shared for 2 rows:
  * 440, 441
  </code></pre>
  <p>I thought adding the id=row_number() would fix that error but it didn't ( when I remove it the same error persists ). Does anyone have any idea on how to fix this?</p>