title: Return graph from function without plotting it
body: <p>I want to write function which returns a graph but it should not plot the graph. It should only plot the graph when I ask it to.</p>
  
  <p>Here is a MWE.</p>
  
  <pre><code>graph_functions &lt;- function(x) {
    plot(1:length(x), x)
    points(1:length(x), x^2)
    t &lt;- recordPlot()
    return(t)
  }
  
  answer &lt;- graph_functions(1:10)
  
  library(cowplot)
  plot_grid(answer, answer)
  </code></pre>
  
  <p>In the above code I do not want it to plot the graph when I first compute the answer by calling <code>graph_functions(1:10)</code>. I only want it to plot the graph when I use <code>plot_grid()</code>.</p>