title: Problem when doing Anova on categorical variable in R
body: <p>I have two variables: <code>decsorgs2</code> and <code>regionfactor</code> (which is a factored "region")</p>
  
  <pre><code>freq(decsorgs2)
   decsorgs2 
              Frequency Percent
   0 Disagree       365   53.76
   1 Agree          314   46.24
   Total            679  100.00
  
  freq(regionfactor)
  regionfactor 
          Frequency Percent
   1            12   1.767
   2            82  12.077
   3           128  18.851
   4            64   9.426
   5           138  20.324
   6            43   6.333
   7            53   7.806
   8            57   8.395
   9           102  15.022
   Total       679 100.000
  </code></pre>
  
  <p>I am trying to do an anova with <code>aov()</code>.</p>
  
  <pre><code>  aov(decsorgs2~regionfactor)
    Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 
     NA/NaN/Inf in 'y'
    In addition: Warning message:
   In model.response(mf, "numeric") : NAs introduced by coercion
  </code></pre>
  
  <p>What are these errors? I don't understand any of these terms</p>
  
  <p>EDIT: Ok, I did a hail-mary random attempt and recoded decsorgs2. </p>
  
  <p>Initially I had:</p>
  
  <blockquote>
    <p>decsorgs2 = recode(DECSORGS, "4:5='0 Disagree'; 1:2='1 Agree'")</p>
  </blockquote>
  
  <p>Now I used:</p>
  
  <blockquote>
    <p>decsorgs2 = recode(DECSORGS, "4:5=0; 1:2=1")</p>
  </blockquote>
  
  <p>It seemed to work. But why? Why does <code>decsorgs2</code> have to be numerical, if the purpose of factoring the variable region was to make it be read as categorical? How do I know which one has to be numerical and which categorical?</p>