title: Function reorder in R and ordering values
body: <p>I'm trying the following function:</p>
  
  <pre><code>stest &lt;- data.frame(group=c("John", "Jane", "James"), mean=c(3, 5, 1))
  transform(stest, group = reorder(group, mean))
  </code></pre>
  
  <p>And expect the output be ordered by <code>mean</code>. Instead, I get:</p>
  
  <pre><code>  group mean
  1  John    3
  2  Jane    5
  3 James    1
  </code></pre>
  
  <p>That is, same order as in the original dataframe.</p>
  
  <p>Do I miss something? How to order a data frame correctly by one of its numerical variables?</p>
  
  <p>Recommendations around is about using <code>reorder</code>, but I can't make it work as expected. Can any loaded packages interfere?</p>