title: How to do side by side bar chart ggplot and retain original sorting
body: <p>Thanks in advance for your help. I have been searching stack overflow and google with this issue and have not been successful.</p>
  
  <p>I need a side by side horizontal bar chart of the word and its frequency in two files. </p>
  
  <p>My data frame is as below:</p>
  
  <pre><code>   head(comp,10)
                WORD FREQ RDFREQ
     170     project   67      5
     20     business   64     14
     117  management   53     13
     59  development   34      4
     211     support   27      6
     215     systems   25     10
     102 information   22      2
     201    software   21      6
     203   solutions   20      2
     220   technical   20      2
  </code></pre>
  
  <p>I have used melt to create the frequency frame as below:</p>
  
  <pre><code>   dfp1 &amp;lt;- melt(comp, value.factor = TRUE) 
     head(dfp1,20)
                WORD variable value
     1       project     FREQ    67
     2      business     FREQ    64
     3    management     FREQ    53
     4   development     FREQ    34
     5       support     FREQ    27
     6       systems     FREQ    25
     7   information     FREQ    22
     8      software     FREQ    21
     9     solutions     FREQ    20
     10    technical     FREQ    20
     11 applications     FREQ    19
     12     planning     FREQ    18
  </code></pre>
  
  <p>My code to plot is </p>
  
  <pre><code>   g &amp;lt;- ggplot(dfp1, aes(x = WORD, y= value, order=-   as.integer(value)))
     g &amp;lt;- g + geom_bar(aes(fill = variable), position = "dodge", stat="identity")
     g &amp;lt;- g + coord_flip() 
     g &amp;lt;- g + theme(axis.text.y = element_text(size=12))
     g &amp;lt;- g + labs(x = "Keyword", y = "Count", 
                title = paste("File1 vs File2")
                )
     print(g)
  </code></pre>
  
  <p>The plot that I get is sorted by the WORD instead of the descending order of frequency. Thanks again and looking forward to the responses. </p>