Edit 2013-04-19: I now use:

d$FACTOR = relevel(d$FACTOR, "LevelToBeFirst")

occasionally repeated for all levels until the order is right.

However: ggplot does not its own ordering…


See the linked article. Ah, indeed I have been in need of that! And had done it a little less elegantly so far. 

More R trivia: Can you believe I hadn’t known “nrow” so far? I mean this nrow(someDataFrame) .

So far I always used length(someDataFrame$id).

Another thing: To me it makes more sense to put the aesthetics into the “ggplot” call, and not into the geoms. Will consistently do that from now on.

End of trivia.

2012-11-15 Addition: here 


is another nice trick to re-order factor levels for ggplot

factor(text.plots$DOSE2, levels= levels(text.plots$DOSE2)[c language=”(3,2,1)”][/c])