tags:

views:

61

answers:

2

I am trying to facet about 14 plots based on a variable that runs from 2-14. The plots show up in the order: 10,11,12,13,14,15,2,3,4,5,6,7,8,9

How do I get them to order from 2-15?

update: ok, so I made it a factor using data$var=as.factor(data$var). The Levels are Levels: 10 11 12 13 14 15 2 3 4 5 6 7 8 9

How do I reorder those?

+2  A: 

Without your data, my best guess would be to turn your faceting variable into a factor that has the levels in the order which you desire.

Greg
ok, I figured out how to reorder levels. Thanks for pushing me in the right direction.
Maiasaura
The code, if anyone is interested is: data$var=factor(data$var, levels(data$var)[c(7:14,1:5)])
Maiasaura
+3  A: 
data$var <- factor(data$var, levels = sort(unique(data$var)))
hadley