title: At least some columns satisfy a condition
body: <p>I have a dataframe of 50000+ rows and 1600+ columns. The first two columns of the data frame are factors and the remaining columns are numeric. I want to discard all rows that have cell values less than 0.1 (&lt;0.1) in less than 80 columns for each row. </p>
  
  <p>More specifically each row is a gene and the columns are samples. The values contain the expression of the gene in a specific sample. If the gene expression value is less than 0.1 in 80(5% of 1600) samples or less then I discard it.</p>
  
  <p>I use the following code</p>
  
  <pre><code>df = df[rowSums(df&gt;0.1)&gt;=80, ]
  </code></pre>
  
  <p><code>df&gt;0.1</code> gives <code>True</code> or <code>False</code> for each element and I compute the <code>sum [True=1 and False = 0]</code> and if the sum is less than 80 , then the row is discarded. </p>
  
  <p>However, since the first two columns of my data frame are factors, it doesnt seem to work that well. It would be of great help if I can choose rowSums only for certain columns. Another equivalent code was</p>
  
  <pre><code>df = df[apply(df[,-1], MARGIN = 1, function(x) sum(x&gt;0.1)&gt;=80}),]
  </code></pre>
  
  <p>Both don't work when I have factors in first two columns. </p>