if-else statement in R
<p>I have a file contains p-values of my analysis. I want to use if else statement to do the following:</p>

<p>if p-value less that 0.01 give a green color. if p-value is greater than 0.01 and less that 0.05 give a red color. if p-value greater than 0.05 give a yellow color.</p>

<p>I tried to use the following code but is doesn't work:</p>

<pre><code>col=ifelse(data &lt; 0.01,"green" , 
           ifelse(data &gt; 0.01 &amp; data &lt; 0.05, "red"), 
                  ifelse(data&gt;0.05, "yellow"))).
</code></pre>