title: Printing multiple ggplots into a single pdf, multiple plots per page
body: <p>I have a list, <code>p</code>, where each element of <code>p</code> is a list of ggplot2 plotting objects.</p>
  
  <p>I would like to output a single pdf containing all the plots in <code>p</code> such that the plots in <code>p[[1]]</code> are on page 1, the plots in <code>p[[2]]</code> are on page 2, etc. How might I do this?</p>
  
  <p>Here's some example code to provide you with the data structure I'm working with--apologies for the boring plots, I picked variables at random.</p>
  
  <pre><code>require(ggplot2)
  p &lt;- list()
  
  cuts &lt;- unique(diamonds$cut)
  for(i in 1:length(cuts)){
      p[[i]] &lt;- list()
      dat &lt;- subset(diamonds, cut==cuts[i])
      p[[i]][[1]] &lt;- ggplot(dat, aes(price,table)) + geom_point() + 
          opts(title=cuts[i])
      p[[i]][[2]] &lt;- ggplot(dat, aes(price,depth)) + geom_point() + 
          opts(title=cuts[i])
  }
  </code></pre>