title: select multiple column that meet a condition
body: <p>I have a data frame and I want to select all rows that meet a particular condition as for example !=0. I can do it for each column but it make a real long line. </p>
  
  <pre><code>df.Individual  &lt;-  df.category[df.category[,10]!=0 &amp; df.category[,9]!=0 ........ &amp; df.category[,2]!=0, ][,1] 
  </code></pre>
  
  <p>I would like to select a group of columns something like this, but I can not figure how!</p>
  
  <pre><code>df.category[df.category[,c(10:5)]!=0 &amp; c(6:2)]&gt;0 ][,1]
  </code></pre>
  
  <p>Thanks!</p>
  
  <pre><code>structure(list(Individual = structure(1L, .Label = c("aaa"), class = "factor"), `Class1` = 1L, 
  `Class2` = 0L, `Class3` = 1L, `Class4 ` = 2L, `Class5` = 3L, `Class6` = 1L, Class7 = 1L, Class8 =    1L, Class9 = 1L), .Names = c("Individual", 
  "Class1", "Class2", "Class3", "Class4", "Class5",  "Class6", "Class7", "Class8", "Class9"), row.names = 2L, class = "data.frame")
  </code></pre>
  
  <p>Edit:</p>
  
  <p>I need to get all the column combination. something like a for cycle. I want to have a list of Individual sorted for their class to use as  factor levels on the y axis of ggplot</p>
  
  <p>as an example. but here are just some combination listed and I want all the possible column combination.</p>
  
  <pre><code>df.Individual.1  &lt;-  df.category[ df.category[,10]!=0 &amp; 
                                  df.category[,9]!=0 &amp; 
                                  df.category[,8]!=0 ,] [,1]
  
  df.Individual.2  &lt;-  df.category[ df.category[,10]!=0 &amp; 
                                  df.category[,9]!=0 &amp; 
                                  df.category[,8]&lt;=0 ,] [,1]
  
  df.Individual.3  &lt;-  df.category[ df.category[,10]!=0 &amp; 
                                  df.category[,9]&lt;=0 &amp; 
                                  df.category[,8]!=0 ,] [,1]
  
  df.Individual.4  &lt;-  df.category[ df.category[,10]!=0 &amp; 
                                  df.category[,9]&lt;=0 &amp; 
                                  df.category[,8]&lt;=0 ,] [,1]
  
  unlist(list(df.Individual.1,df.Individual.2,df.Individual.3,df.Individual.4))
  </code></pre>
  
  <p>At the end I need a list with individual sorted for their class status. First All Class positiv, than the first class is positiv and the other are one each negative.  </p>
  
  <pre><code>1 1 1 
  1 1 0
  1 0 1
  1 0 0
  0 1 1
  0 1 0    
  0 0 1
  0 0 0 
  </code></pre>
  
  <p>here an example for 3  columns.
  Thanks!</p>