title: Why is "relevel" not working with my logistic regression?
body: <p>I'm trying to use the instruction <em>relevel</em> to redefine the refrence category in a factor to the last category. </p>
  
  <p>At first, I got an error:</p>
  
  <pre><code>base1 &lt;- within(base1, DPROS &lt;- relevel(DPROS, ref = 4))  
  Error in relevel.default(DPROS, ref = 4) : 'relevel' only for factors
  </code></pre>
  
  <p>I used the <em>des</em> instruction of the epicalc package to check if DPROS was numeric or factor: </p>
  
  <pre><code>des(base1)
  
  No. of observations =  380   
    Variable      Class           Description  
  1 CAPSULE       numeric                    
  2 AGE           numeric                    
  3 DPROS         numeric                    
  4 DCAPS         numeric                    
  5 PSA           numeric  
  </code></pre>
  
  <p>I used <em>as.factor</em> to make DPROS a factor. </p>
  
  <pre><code>DPROS &lt;- as.factor(DPROS)
  </code></pre>
  
  <p>But I still got the same error:</p>
  
  <pre><code>base1 &lt;- within(base1, DPROS &lt;- relevel(DPROS, ref = 4))  
  Error in relevel.default(DPROS, ref = 4) : 'relevel' only for factors
  </code></pre>
  
  <p>Using <em>des</em> it still said DPROS was numeric, but <em>is.factor(DPROS)</em> returned TRUE.</p>
  
  <p>What am I doing wrong?    </p>