title: How to make triplet set of columns and apply function to it
body: <p>I have a dataframe with <code>mycols</code>. You can see mycols has <code>^SQN</code>, <code>^WES</code> and <code>^WGS</code> column sets. I want to make triplet set of <code>SQN</code>, <code>WES</code> and <code>WGS</code> columns (I dont want to include <code>(Pile:up)$</code> and <code>:AD$</code> columns) in the same order (you can see the extension is same for SQN,WES and WGS for every set) across <code>mycols</code>. In other word, I want to make a group of SQN, WES and WGS that have same extension. I then have a function called <code>myfunc</code>. I want to apply that function to each triple set thus formed. </p>
  
  <pre><code>mycols&lt;- c("SQN:IDH2:G515T:R172M","WES:IDH2:G515T:R172M"    ,"WES:IDH2:G515T:R172M:AD:(Pile:up)", "WGS:IDH2:G515T:R172M","SQN:JAK1:A1432T:T478S",   "WES:JAK1:A1432T:T478S" ,"WES:JAK1:A1432T:T478S:AD:(pile:up)","WGS:JAK1:A1432T:T478S","SQN:JAK1:T1868C:V623A","WES:JAK1:T1868C:V623A","WES:JAK1:T1868C:V623A:AD","WES:JAK1:T1868C:V623A:AD:(Pile:up)",  "WGS:JAK1:T1868C:V623A")
  </code></pre>
  
  <p>result:</p>
  
  <pre><code>triplet1
  "SQN:IDH2:G515T:R172M",   "WES:IDH2:G515T:R172M", "WGS:IDH2:G515T:R172M" 
  triplet2
  "SQN:JAK1:A1432T:T478S","WES:JAK1:A1432T:T478S","WGS:JAK1:A1432T:T478S",
  triplet3
  "SQN:JAK1:T1868C:V623A","WES:JAK1:T1868C:V623A","WGS:JAK1:T1868C:V623A"
  </code></pre>
  
  <p>So I can simply call my function to triplet1, triple 2, triplet3... </p>