title: reorder facets by multiple variables in ggplot
body: <p>I have a data frame with the following column names/header:</p>
  
  <pre><code> date         time              id            datetime    site  origin           species         genus    sex PP repro
  </code></pre>
  
  <p>I am trying to ggplot a faceted figure with the y-axis being all of my "id"s, in order of "sex" and then in order of "repro"... so ideally all female "ids" will be at the top and in order of repro status, and then under that will be all male "ids", grouped together with their repro status (females - pregnant, females - non pregnant, males - reproducing, males -non - in that order).  This is what my ggplot code looks like currently:</p>
  
  <pre><code>    Presence&lt;-ggplot(data, aes(x=date,y=reorder(sex,repro)))+
    geom_point(aes(x=date,y=Presence,colour=sex))+facet_grid(id~.)+
    theme()+
    ylab("\n")+
    theme(legend.position="none",
          axis.text.y= element_blank(),
          strip.text.y=element_text(angle=0))
  </code></pre>
  
  <p>reordering by two variables here obviously didn't work...</p>
  
  <p>In case this is useful... here's some more information from dput:</p>
  
  <pre><code>    structure(list(date = structure(c(16439, 16439, 16443, 16444, 
  16444, 16445), class = "Date"), time = c("05:11:00.470", "19:41:08.120", 
  "20:45:38.570", "22:27:59.370", "22:53:13.370", "18:44:49.630"
  ), id = c("989001000312244", "989001000312244", "989001000312214", 
  "989001000312285", "989001000312285", "989001000312252"), datetime =    structure(list(
      sec = c(0.47, 8.12, 38.57, 59.37, 13.37, 49.63), min = c(11L, 
      41L, 45L, 27L, 53L, 44L), hour = c(5L, 19L, 20L, 22L, 22L, 
      18L), mday = c(4L, 4L, 8L, 9L, 9L, 10L), mon = c(0L, 0L, 
      0L, 0L, 0L, 0L), year = c(115L, 115L, 115L, 115L, 115L, 115L
      ), wday = c(0L, 0L, 4L, 5L, 5L, 6L), yday = c(3L, 3L, 7L, 
      8L, 8L, 9L), isdst = c(0L, 0L, 0L, 0L, 0L, 0L), zone = c("PST", 
      "PST", "PST", "PST", "PST", "PST"), gmtoff = c(NA_integer_, 
      NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
      )), .Names = c("sec", "min", "hour", "mday", "mon", "year", 
  "wday", "yday", "isdst", "zone", "gmtoff"), class = c("POSIXlt", 
  "POSIXt")), site = c("chivato", "chivato", "chivato", "chivato", 
  "chivato", "chivato"), origin = structure(c(2L, 2L, 2L, 2L, 2L, 
  2L), .Label = c("carmen", "chivato", "la capilla", "las cuevas", 
  "lto1"), class = "factor"), species = structure(c(2L, 2L, 2L, 
  2L, 2L, 2L), .Label = c("californicus", "yerbabuenae"), class = "factor"), 
      genus = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("Leptonycteris", 
      "Macrotus"), class = "factor"), sex = structure(c(1L, 1L, 
      2L, 2L, 2L, 2L), .Label = c("female", "male", "unrecorded"
      ), class = "factor"), PP = c(1, 1, 1, 1, 1, 1), repro = structure(c(2L, 
      2L, 2L, 2L, 2L, 2L), .Label = c("lactating", "non", "postlactating", 
      "pregnant", "testes"), class = "factor")), .Names = c("date", 
  "time", "id", "datetime", "site", "origin", "species", "genus", 
  "sex", "PP", "repro"), row.names = c(846L, 878L, 1101L, 1152L, 
  1154L, 1185L), class = "data.frame")
  </code></pre>