title: Adding plots to a list ggplot2
body: <p>I am trying to add ggplot2 plots to a list so that I can use the ggarrange function from ggpubr to organise them over several pages. </p>
  
  <p>As there are several hundred plots I am using a function to generate and save the plots, but I can't get it to return the plots to the environment or write the names to a list. </p>
  
  <p>I'm fairly certain it's something simple that I am missing but can't spot it. </p>
  
  <p>The plotting function that I am using is:</p>
  
  <pre><code>histFacet.plot &lt;- function(x, results, info, ...) {
  
    md&lt;- names(x) %in% c("rn","Taxa","year","rep","block","column",
                         "range", "entity_id")
    traits &lt;- names(x[ , !md])
    for (i in traits) {
      i &lt;-ggplot(data = x, aes_string(x = i)) + 
        geom_histogram(colour="black", fill="white") + 
        #facet_grid(x$year ~ .) +
        theme_bw() +
        xlab(paste0(i)) +
        ylab("Frequency") +
        theme(panel.grid.major = element_blank()) +
        theme(panel.grid.minor = element_blank()) +
        theme(axis.text = element_text(size = 15)) +
        theme(axis.title = element_text(size = 15)) +
        theme(strip.text = element_text(size = 15)) 
      #ggsave(paste0(i,"_",info,".pdf"),path=paste(results, sep=''))
      plotList&lt;- list(plotList, list(i))
      print(i)
  
    }
    return(i)
  }
  
  histFacet.plot(pd,'~/Dropbox/Research_Poland_Lab/AM Panel/Figures/Hist/',
                 "_raw_2018")
  </code></pre>