title: Convert chr to ordered factor and set factor levels causing error
body: <p>I have a <code>dataframe</code> as R, as seen below, that includes the conditions "Used", "Certified pre-owned", and "New.  In my actual dataset, when I read in the dataset, this variable is loaded as a <code>chr</code>.  Using the <code>factor</code> function, I know how to convert a <code>chr</code> to a <code>factor</code>,but I want to maintain the order of the factor, and set "Used" as the baseline. </p>
  
  <p>I'd tried everything that I can find, but I'm obviously missing something.  How do I correct convert a <code>chr</code> to a ordered factor and specify the order level?</p>
  
  <pre><code># example df
  df &lt;- data.frame(condition = c('Certified pre-owned', 'Used', 'Used', 'Used', 'Used', 'Used', 'New', 'Used', 'Used'))
  
  # show structure
  str(df)
  
  'data.frame':   9 obs. of  1 variable:
   $ condition: Factor w/ 3 levels "Certified pre-owned",..: 1 3 3 3 3 3 2 3 3
  
  # change order of conditoin
  df$condition &lt;- as.ordered(df$condition, levels=c("Used", "Certified pre-owned", "New"))
  
  Error in as.ordered(df$condition, levels = c("Used", "Certified pre-owned", : unused argument (levels = c("Used", "Certified pre-owned", "New"))
  Traceback:
  
  1. as.ordered(df$condition, levels = c("Used", "Certified pre-owned", "New"))
  
  # convert to factor, but without levels
  df$condition &lt;- as.ordered(factor(df$condition))
  
  # but the order puts them in alphabetical order, which is not what I want
  levels(df$condition)
  
  'Certified pre-owned' 'New' 'Used' 
  </code></pre>