title: Polr function error: "response must be a factor"
body: <p>I'm using the <code>polr</code> function to run an ordered logistic regression. <code>Reglog</code> is my data frame and <code>Reglog$wtp</code> is the response variable. Here is a list of all the variables in my model.</p>
  <ol>
  <li>wtp &lt;- Reglog$WTP</li>
  <li>perception&lt;- Reglog$Persepsi</li>
  <li>income &lt;- Reglog$pendapatan</li>
  <li>age &lt;- Reglog$usia</li>
  <li>education &lt;- Reglog$usia</li>
  <li>experience &lt;- Reglog$pengalaman</li>
  <li>home &lt;- Reglog$rumah</li>
  </ol>
  <p>At the first, <code>wtp</code> was <code>chr</code>, so I converted it into an <code>ordered factor</code>.</p>
  <pre><code>Reglog$WTP &lt;- as.ordered(Reglog$WTP) 
  
  str(Reglog) 
  tibble [30 x 7] (S3:
  tbl_df/tbl/data.frame)  
  $ WTP : Ord.factor w/ 3 levels &quot;1&quot;&lt;&quot;2&quot;&lt;&quot;3&quot;: 1 1 3 2 2 2 2 1 2 2 ...
  </code></pre>
  <p>The result shows that <code>wtp</code> is an ordered factor,  but when I use <code>polr</code> to run the regression, it says that <code>wtp</code> is not a factor.</p>
  <pre><code>&gt; model &lt;- polr(wtp~persepsi+pendapatan+usia+pendidikan+pengalaman+pendapatanrt, data = Reglog, Hess = TRUE)
  Error in polr(wtp ~ persepsi + pendapatan + usia + pendidikan + pengalaman +  : 
    response must be a factor
  </code></pre>
  <p>How do I fix this? Thank you.</p>