title: ggplot2: can't sort x axis by y value
body: <p>I have problem in sorting x axis by y value in ggplot2: here is the code below</p>
  
  <pre><code>#Data
  hp=read.csv(textConnection(
  "class,year,amount
  a,99,100
  a,100,200
  a,101,150
  b,100,50
  b,101,100
  c,102,70
  c,102,80
  c,103,90
  c,104,50
  d,102,90"))
  hp$year=as.factor(hp$year)
  
  #Plotting
  p=ggplot(data=hp)  
  p+geom_bar(binwidth=0.5,stat="identity")+  #
  aes(x=reorder(class,amount),y=amount,label=amount,fill=year)+
  theme()
  </code></pre>
  
  <p>Here is the result:</p>
  
  <p><img src="https://i.stack.imgur.com/pYJiX.png" alt="enter image description here"></p>
  
  <p>How do I sort my x axis by a c b d, which amount sorted by decreasing from 450, 290, 150, 90. What should I do?</p>