title: R: How to use setdiff on two string vectors by only comparing the first 3 tab delimited items in each string?
body: <p>I am trying to figure out a way in R to take the difference of two string vectors, but only based on the first 3 columns that are tab delimited in each string. For Example this is list1 and list2</p>
  
  <p>list1: </p>
  
  <pre><code>        "1\t1113200\t1118399\t1\t1101465\t1120176\tENSRNOG00000040300\tRaet1l\t0\n" 
          "1\t1180200\t1187599\t1\t1177682\t1221416\tENSRNOG00000061316\tAABR07000121.1\t0\n"
          "1\t1180200\t1187599\t1\t1177632\t1221416\tENSRNOG00000061316\tAABR07000121.1\t0\n"
  </code></pre>
  
  <p>list2:</p>
  
  <pre><code> "1\t1113200\t1118399\t1\t1101465\t1120176\tENSRNOG00000040300\tRaet1l\t0\n" 
    "1\t1180200\t1187599\t1\t1177682\t1221416\tENSRNOG00000061316\tAABR07000121.1\t0\n"
  </code></pre>
  
  <p>i want to do <code>setdiff(list2,list1)</code> , so that i just get everything in list2 that is non-existent in list1, however i want to do it based on just the first 3 tab delimited strings. So in list1 i would only consider: </p>
  
  <pre><code>   "1\t1113200\t1118399"
  </code></pre>
  
  <p>from the first entry. However i still want the full string returned. I only want to compare using the first 3 columns. I am having trouble figuring out how to do this, any help would be appreciated. Ive already looked at several SO posts, none of them seemed to help. </p>