title: Removing duplicate observations in new lines inside each cell
body: <p>I have some data which has observations on new lines. For example, line 17;</p>
  
  <pre><code>&gt; d[17, ]
  # A tibble: 1 x 2
      grp figures                                                                       
    &lt;int&gt; &lt;chr&gt;                                                                         
  1  9923 "0.26 - 0.31\n0.97 - 1.02\n1.29 - 1.34\n0.26 - 0.31\n0.97 - 1.02\n1.29 - 1.34"
  </code></pre>
  
  <p>Looks like:</p>
  
  <pre><code>0.26 - 0.31
  
  0.97 - 1.02
  
  1.29 - 1.34   # duplicate
  
  0.26 - 0.97
  
  1.29 - 1.34   # duplicate
  </code></pre>
  
  <p>I want to remove the lines inside each cell which has duplicates. I know of the <code>duplicate</code> functions but I am not sure how to apply them by line.</p>
  
  <p>Data:</p>
  
  <pre><code>d &lt;- structure(list(grp = c(10467L, 2485L, 4749L, 331L, 2442L, 2847L, 
  5910L, 10344L, 3382L, 10488L, 1665L, 6546L, 781L, 570L, 1109L, 
  2181L, 9923L, 3107L, 844L, 6224L, 2781L, 671L, 1349L, 2410L, 
  10256L, 944L, 5505L, 4220L, 4638L, 4917L, 868L, 9130L, 1168L, 
  4294L, 5274L, 10836L, 3416L, 7427L, 2334L, 10898L), figures = c("1.13 - 1.21", 
  "380 - 400", "4.35 - 4.65", "1.94 - 2.03\n2.33 - 2.42", "0.48 - 0.54", 
  "3.64 - 3.66", "1.14 - 1.20", "2.87 - 2.90", "3.17 - 3.22\n3.10 - 3.20", 
  "0.40 - 0.50\n0.35 - 0.45\n51 - 53", "1.01 - 1.10", "3.79 - 3.81\n3.76 - 3.80", 
  "1.10 - 1.17", "1.57 - 1.67\n1.65 - 1.75", "1.35 - 1.45", "1.36 - 1.54\n1.75 - 1.80", 
  "0.26 - 0.31\n0.97 - 1.02\n1.29 - 1.34\n0.26 - 0.31\n0.97 - 1.02\n1.29 - 1.34", 
  "1.10 - 1.20", "1.35 - 1.50\n1.65 - 1.80\n1.35 - 1.50\n1.65 - 1.80\n1.35 - 1.50\n1.65 - 1.80", 
  "2.90 - 2.95", "3.05 - 3.12\n3.05 - 3.12", "0.45 - 0.50\n0.65 - 0.70\n0.60 - 0.65", 
  "1.58 - 2.08", "1.43 - 1.48", "57.9 - 72.9\n12.5 - 14.5\n0.45 - 0.52\n1.55 - 1.62", 
  "1.97 - 2.01.\n1.87 - 1.94.\n2.01 - 2.08\n2.15 - 2.19", "3.25 - 3.34", 
  "0.90 - 0.94", "3.45 - 3.55\n0.60 - 0.64\n0.70 - 0.74", "0.05 - 0.08", 
  "2.30 - 2.40", "0.35 - 0.37\n0.33 - 0.37.\n1.05 - 1.07", "3.45 - 3.65\n3.45 - 3.65", 
  "3.11 - 3.15", "0.75 - 1.00\n1.10 - 1.30", "3.50 - 3.60\n3.47 - 3.57\n3.30 - 3.40\n3.47 - 3.57\n0.10 - 0.15", 
  "5.75 - 6.00\n7.00 - 7.50\n0 - 50\n500 - 550", "3.35 - 3.45\n3.30 - 3.45", 
  "1.60 - 1.80.\n1.60 - 1.80", "0.98 - 1.03")), class = c("tbl_df", 
  "tbl", "data.frame"), row.names = c(NA, -40L))
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>The observation for <code>grp = 9923</code> before removing the duplicates is:</p>
  
  <pre><code>0.26 - 0.31
  
  0.97 - 1.02
  
  1.29 - 1.34   # duplicate
  
  0.26 - 0.97
  
  1.29 - 1.34   # duplicate
  </code></pre>
  
  <p>Then I look at the observation after removing the duplicates and I get:</p>
  
  <pre><code>0.26 - 0.31
  0.97 - 1.02
  1.29 - 1.34
  </code></pre>
  
  <p>It has correctly removed the duplicate but it has also removed the observation <code>0.26 - 0.97</code> which isn't a duplicate.</p>