title: R multiple conditions in row selection of matrix
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6933598/r-subset-logical-and-operator-for-combining-conditions-should-be-not">R: subset() logical-and operator for combining conditions should be &amp; not &amp;&amp;</a>  </p>
  </blockquote>
  
  
  
  <p>I have a simple question, but I don't know how to solve this...
  I want to select all rows where value_1 > 0 and value_2 > 0.
  Now I have this code:</p>
  
  <pre><code>dataOnBoth&lt;-data[data$value_1 &gt; 0,][data$value_2 &gt; 0,]
  </code></pre>
  
  <p>When I head this data, ordering on log2_fold_change, I have This output:</p>
  
  <pre><code>gene_id        sample_1 sample_2 status   value_1 value_2 log2_fold_change
  86  uc001aen.1       q1       q2 NOTEST 0.0619347       0    -1.79769e+308
  150 uc001ahx.1       q1       q2 NOTEST 0.0432199       0    -1.79769e+308
  186 uc001ajk.1       q1       q2 NOTEST 0.0854541       0    -1.79769e+308
  251 uc001amf.1       q1       q2 NOTEST 0.0636211       0    -1.79769e+308
  358 uc001are.3       q1       q2 NOTEST 0.3642040       0    -1.79769e+308
  394 uc001ass.1       q1       q2 NOTEST 0.0196794       0    -1.79769e+308
          test_stat   p_value q_value significant
  86  -1.79769e+308 0.4767020       1          no
  150 -1.79769e+308 0.3960920       1          no
  186 -1.79769e+308 0.0631033       1          no
  251 -1.79769e+308 0.4428030       1          no
  358 -1.79769e+308 0.1083640       1          no
  394 -1.79769e+308 0.1489190       1          no
  </code></pre>
  
  <p>So R didn't test the second condition...
  When using the &amp; to test both conditions, I receive 0 rows:</p>
  
  <pre><code>dataOnBoth&lt;-data[data$value_1 &gt; 0 &amp;&amp; data$value_2 &gt; 0,]
  </code></pre>
  
  <p>How do I select all rows where value_1 > 0 and value_2 > 0?</p>