A few weeks ago, I used ggplot2 to create a faceted graph in which faxes were ordered by the last value in a data frame. I had no serious problems until he switched to reordering, because I did not understand all the difficulties of orders, factors and levels. However, after an hour or two (or three) calls to SO messages, I got it working.
When I returned to the script today, it no longer worked, because now it sorts the faces alphabetically, and not according to the final value of the data frame. (I think that I initially “fixed” the problem during the mess on the R console and did not actually add a solution for the script.) Instead of spending a couple more hours this evening, I'm going to rush to SO charity.
Q. How can I sort faces by a given value, rather than alphabetically by the name of each face? Please note that the code below is an example; real data has several tens of elements.
The edited code below to reflect the additional input from @joran; faces are now sorted and filled accordingly. Successful mission.
# Version 3 require(ggplot2)
source share