title: Ifelse() with three conditions in R
body: <p>I have data as following:</p>
  <pre><code>    RNA$MMP2
   [1]  1.506000000  0.957833333  2.285500000 -0.089333333 -1.233166667
   [6]  1.591500000 -1.396500000 -0.260500000  0.583000000 -0.716333333
  [11]  1.628833333 -0.390000000 -0.466166667 -0.550666667  1.001666667
  [16]  1.399000000 -0.454500000 -0.492833333  0.695166667  0.397666667  
  </code></pre>
  <p>If I were to replace these numeric variables with character variables based on a certain threshold (e.g., 1.0), I implement the following:</p>
  <pre><code>ifelse(RNA$MMP2 &lt;= 1.0 ,&quot;low&quot;,&quot;high&quot;)-&gt;x
  </code></pre>
  <p>What if I need to categorize into three character variables:</p>
  <pre><code>a) RNA$MMP2 &lt; 0.5 ,&quot;low&quot;; 
  
  b) RNA$MMP2 &gt; 0.5 and &lt; 1.0, &quot;medium&quot;;
  
  c) RNA$MMP2 &gt; 1.0, &quot;high&quot;;
  </code></pre>
  <p>Suggestions will be highly appreciated.</p>