title: R ggplot2 facet_grid "hierarchical" formatting with 3 variables or more
body: <p>I'm trying to get a nice display when having multiple variables on one dimension of my <code>facet_grid</code> so that instead of repeating the name of all variables for each column (or row) I have a merged box over sub-boxes.
  Taking a concrete example with a default dataset from R (based on the R Cookbook):</p>
  
  <pre><code>library(reshape2)
  sp &lt;- ggplot(tips, aes(x=total_bill, y=tip/total_bill)) +
        geom_point(shape=1) +
        facet_grid(smoker ~ sex+day)
  sp
  </code></pre>
  
  <p>This returns something like the top part of <a href="https://i.stack.imgur.com/huOMs.jpg" rel="nofollow noreferrer">this figure</a>, with Female/Male being repeated at the top of each column. Is there a way (in R) of instead merging all the gender blocks to get something like the bottom part of the figure I uploaded? (I did this one with Gimp, needless to say it's not an ideal option)</p>
  
  <p><img src="https://i.stack.imgur.com/huOMs.jpg" alt=""></p>
  
  <p>I looked up the documentation for <code>facet_grid</code> and it feels like the solution would be to <a href="http://ggplot2.tidyverse.org/reference/labellers.html#writing-new-labeller-functions" rel="nofollow noreferrer">create a new labeller function</a>, but I'm just too new to R to be able to go for it. I've searched a bit more to see if someone had already solved this problem but didn't seem to find any answers.</p>
  
  <p>Does anyone know of a custom labeller function that's been already created for that purpose, or does anyone know how to create such a custom labeller function? That would be just amazing.</p>