How to filter rows in R with a specific value? : <p>My dataset has 21 columns with 4625 rows. I can't paste few lines of the dataset due to the content of the column here, just giving a demo dataset: </p>

<pre><code>   c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 
1  GCF1 ............................10..................................... 386
2  GCF2 ............................10......................................10
3  GCF3 ............................32......................................10
</code></pre>

<p>The column21 have 331 different number and I want to group my data according to the number of column21. For example, I want to see how many of the GCFs have '10' and their characteristics according to the other columns.I tried the following command. It comes with the 236 rows those have 10 in column 11 but not in column21. </p>

<pre><code> f2 &lt;- f1[rowSums(sapply(f1[-21], '%in%', c('10'))) &gt; 0,]
   c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 
1  GCF1 ............................10......................................386
2  GCF2 ............................10......................................10
</code></pre>

<p>How can I sort rows on the basis of value in column 21 ? </p>
