title: Substitute p values for stars in data frame in R
body: <p>I have a <code>data.frame</code> <code>dfP</code> with a column <code>Spearman_p</code> that contains p values (numeric data). I would like to substitute them for p value summary stars. I use this code:</p>
  
  <pre><code> dfP$Spearman_p[dfP$Spearman_p &lt; 0.0001] &lt;- "****"
   dfP$Spearman_p[dfP$Spearman_p &lt; 0.001] &lt;- "***"
   dfP$Spearman_p[dfP$Spearman_p &lt; 0.01] &lt;- "**"
   dfP$Spearman_p[dfP$Spearman_p &lt; 0.05] &lt;- "*"
   dfP$Spearman_p[dfP$Spearman_p &gt; 0.05] &lt;- "ns"
  </code></pre>
  
  <p>However, this changes <strong>all</strong> p values &lt;0.05 (so also those &lt;0.01) to * (one star).</p>
  
  <p>I suspect that R considers **** as a numeric &lt;0.05 in subsequent steps. Is that correct? If so, how can I circumvent this, please?</p>
  
  <p>Thank you.</p>