text: user1377: I have around 1200 samples as columns and 60,000 genes with Htseq-Counts data. Before normalization with voom function I want to do filtering step. 
  I want to remove genes whose expression is == 0 in at least 10 samples.
  Can I do this with read counts itself or should I transform counts to cpm?
  If filtering with counts data is fine May I know how to do this.
  
  user48: While this answers explains how to do it I want to address when and why and which thresholds to do it.
  Filtering the genes with low counts is usually done because the counts are not reliable it would be noise, specially when there are low number of samples these genes disturb power of the analysis. However with 1200 samples having 10 or more samples without any count is valuable information because you have enough samples to estimate if this is due to a latent or known variable or if it is due to noise. 
  The CPM are used because the size of the library per sample affects the power of the experiment. The higher the library size the easier is to find if a gene is expressed or not. CPM are calculated to take into account that effect. Filtering by counts or CPM will result in different genes filtered if you use other thresholds than 0 (for instance I have filtered those genes that the average CPM where below 1, which would be different to filtering by those that the average counts is below 1.) 
  
  user939: If you have your counts in a data.frame called counts, something like this might work:
  filtered.counts <- counts[rowSums(counts==0)<10, ]
  
  For example lets assume the following data frame.
  > A <- c(0,0,0,0,0)
  > B <- c(0,1,0,0,0)
  > C <- c(0,2,0,2,0)
  > D <- c(0,5,1,1,2)
  > 
  > counts <- data.frame(A=A, B=B, C=C, D=D)
  > counts
    A B C D
  1 0 0 0 0
  2 0 1 2 5
  3 0 0 0 1
  4 0 0 2 1
  5 0 0 0 2
  
  And now you would want to remove the genes with at least 3 zeroes or more:
  > filtered.counts <- counts[rowSums(counts==0)<3, ]
  > 
  > filtered.counts
    A B C D
  2 0 1 2 5
  4 0 0 2 1
  
  Every gene with 3 or more zeroes is now removed.
  
original_text: 1377: <p>I have around 1200 samples as columns and 60,000 genes with Htseq-Counts data. Before normalization with voom function I want to do filtering step. </p>
  
  <p>I want to remove genes whose expression is == 0 in at least 10 samples.</p>
  
  <p>Can I do this with read counts itself or should I transform counts to cpm?</p>
  
  <p>If filtering with counts data is fine May I know how to do this.</p>
   48: <p>While <a href="https://bioinformatics.stackexchange.com/a/2441/48">this answers</a> explains how to do it I want to address when and why and which thresholds to do it.</p>
  
  <p>Filtering the genes with low counts is usually done because the counts are not reliable it would be noise, specially when there are low number of samples these genes disturb power of the analysis. However with 1200 samples having 10 or more samples without any count is valuable information because you have enough samples to estimate if this is due to a latent or known variable or if it is due to noise. </p>
  
  <p>The CPM are used because the size of the library per sample affects the power of the experiment. The higher the library size the easier is to find if a gene is expressed or not. CPM are calculated to take into account that effect. Filtering by counts or CPM will result in different genes filtered if you use other thresholds than 0 (for instance I have filtered those genes that the average CPM where below 1, which would be different to filtering by those that the average counts is below 1.) </p>
   939: <p>If you have your counts in a data.frame called <code>counts</code>, something like this might work:</p>
  
  <pre><code>filtered.counts &lt;- counts[rowSums(counts==0)&lt;10, ]
  </code></pre>
  
  <p>For example lets assume the following data frame.</p>
  
  <pre><code>&gt; A &lt;- c(0,0,0,0,0)
  &gt; B &lt;- c(0,1,0,0,0)
  &gt; C &lt;- c(0,2,0,2,0)
  &gt; D &lt;- c(0,5,1,1,2)
  &gt; 
  &gt; counts &lt;- data.frame(A=A, B=B, C=C, D=D)
  &gt; counts
    A B C D
  1 0 0 0 0
  2 0 1 2 5
  3 0 0 0 1
  4 0 0 2 1
  5 0 0 0 2
  </code></pre>
  
  <p>And now you would want to remove the genes with at least 3 zeroes or more:</p>
  
  <pre><code>&gt; filtered.counts &lt;- counts[rowSums(counts==0)&lt;3, ]
  &gt; 
  &gt; filtered.counts
    A B C D
  2 0 1 2 5
  4 0 0 2 1
  </code></pre>
  
  <p>Every gene with 3 or more zeroes is now removed.</p>
  