title: Histogram Factor Ordering
body: <p>I'm having problems ordering my factors of my Histogram.
  My data is something like this:</p>
  
  <pre><code>ID  onderlaag
  1  strooisel
  2  geen
  3  strooisel
  4  kniklaag
  5  gras
  6  geen
  .
  .
  </code></pre>
  
  <p>I've made my histogram using the barplot() function: </p>
  
  <blockquote>
    <p>barplot(table(onderlaag),ylim=c(0,250))</p>
  </blockquote>
  
  <p>The order of the histogram bars here are alphabetically but I would like to have them ordered more in the order of: strooisel - geen - gras - kniklaag.</p>
  
  <p>I have used the factor function but my barplot has no bars anymore after I've done this</p>
  
  <blockquote>
    <p>onderlaag2=factor(onderlaag,levels=c("Strooisel","Geen","Gras","Kniklaag"))</p>
  </blockquote>
  
  <p>How can I do this?</p>