title: How to return combined plot object in a function with single handler in R
body: <p>I have the following code:</p>
  
  <pre><code>attach(mtcars)
  par(mfrow=c(2,2))
  plot(wt,mpg, main="Scatterplot of wt vs. mpg")
  plot(wt,disp, main="Scatterplot of wt vs disp")
  hist(wt, main="Histogram of wt")
  boxplot(wt, main="Boxplot of wt")
  </code></pre>
  
  <p>Which create this:</p>
  
  <p><a href="https://i.stack.imgur.com/6Dov6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6Dov6.jpg" alt="enter image description here"></a>  </p>
  
  <p>What I want to do is to put those code inside a function so that 
  it returns an object that holds these plots with a single handler.
  How can I achieve that?</p>
  
  <p>I tried this but doesn't work:</p>
  
  <pre><code>test_handle &lt;- function() {
  
    attach(mtcars)
    par(mfrow=c(2,2))
    plot(wt,mpg, main="Scatterplot of wt vs. mpg")
    plot(wt,disp, main="Scatterplot of wt vs disp")
    hist(wt, main="Histogram of wt")
    boxplot(wt, main="Boxplot of wt")
  
    # how can I put 4 objects into 1 handler and return it?
  
  }
  </code></pre>