title: ggplot2, geom_bar, dodge, order of bars
body: <p>I'd like to have ordered bars in dodge <code>geom_bar</code>. Do you know how to deal with it? </p>
  
  <p>My code:</p>
  
  <pre><code>ttt &lt;- data.frame(typ=rep(c("main", "boks", "cuk"), 2),
                    klaster=rep(c("1", "2"), 3),
                    ile=c(5, 4, 6, 1, 8, 7))
  
  ggplot()+
      geom_bar(data=ttt, aes(x=klaster, y=ile, fill=typ),
               stat="identity", color="black", position="dodge")
  </code></pre>
  
  <p>And example plots to better understand the problem:</p>
  
  <p>What I have:</p>
  
  <p><img src="https://i.stack.imgur.com/TVJfK.png" alt=""></p>
  
  <p>What I would like to have:</p>
  
  <p><img src="https://i.stack.imgur.com/cV9AU.png" alt=""></p>