I have a data frame that looks like this
df <- data.frame(id=rep(c(1,5,2,6,4,3), each=5),
group=rep(c(1,2,2,2,1,1), each=5),
var1=runif(30))
I now want to plot var1 using ggplot and facet the plot by id, but sort the facets by group (and by id within group). I gather that I have to make id a factor with levels that sort neatly by group but I cannot figure out how to accomplish this elegantly.
