title: Select rows by multiples conditions at columns
body: <p>I'm trying to get a value from different columns but at the same position in the string. The column value looks like:</p>
  
  <pre><code>"0/1:15,0,52:3:13"
  "1/0:15,0,52:3:13"
  "0/0:15,0,52:3:13"
  "1/1:15,0,52:3:13"
  </code></pre>
  
  <p>And i want to filter by <code>0/1</code> and get all the rows that match with that condition by a <code>data.frame</code>. For that I can use:</p>
  
  <pre><code>df1 &lt;- dplyr::filter(df, grepl("0/1", nameofthecolumn))
  </code></pre>
  
  <p>And it works but when I try to filter by <strong>2 conditions</strong> like <code>0/1</code> and <code>1/1</code> I try the following  line and it does not work. That line returns an empty <code>data.frame</code> <code>0 obs. of X variables</code>:</p>
  
  <pre><code>df1 &lt;- dplyr::filter(df, grepl(paste("0/1", "1/1"), paste("namesofthecolumn1", "nameofthecolumn2"))
  </code></pre>
  
  <p>Then I need to fix that function and make different conditions for different columns, and if a row (same row for X columns) contains <code>0/1</code>, the other column <code>1/1</code> and the other "0/0", count all the 1s so i get the value : <code>3</code>.</p>
  
  <p>Then I'm asking two questions:</p>
  
  <p>1 - How can I fix my line to filter by a list of conditions and a list of columns?</p>
  
  <p>2 - How can I sum/count all the 1s from a row by a list of columns?</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Edit:</p>
  
  <p>Example of data.frame to work:</p>
  
  <pre><code>column1 &lt;- c("0/1:15,0,52:3:13", "1/1:152,144,0,132,107,129:49:99", "0/1:26,0,7:54:10", "0/0:0,12,115:4:14", "1/1:219,57,0:19:99", "0/0:0,21,255:96:21")
  column2 &lt;- c("1/1:15,0,52:3:13", "1/1:152,144,0,132,107,129:49:99", "0/1:26,0,7:54:10", "0/1:0,12,115:4:14", "0/0:219,57,0:19:99", "0/0:0,21,255:96:21")
  chrom &lt;- c("chr0", "chr0", "chr1", "chr1", "chr2", "chr2")
  df &lt;- data.frame(chrom, column1, column2)
  </code></pre>
  
  <p>I want to filter for example by 0/1 and 1/1 so i get all the rows that at least have 0/1 or 1/1:</p>
  
  <pre><code>chrom   column1             colum2
  chr 0   0/1:15,0,52:3:13    1/1:15,0,52:3:13
  chr 0   1/1:152,144,0,132,107,129:49:99    1/1:152,144,0,132,107,129:49:99
  chr 1   0/1:26,0,7:54:10    0/1:26,0,7:54:10
  chr 1   0/0:0,12,115:4:14   0/1:0,12,115:4:14
  chr 2   1/1:219,57,0:19:99  0/0:219,57,0:19:99
  </code></pre>
  
  <p>I get all rows except the last one because the last one does not contain 0/1 or 1/1.</p>