title: Custom function which creates loess regression dataset
body: <p>I have a way of creating a loess regression dataset however I need to perform it multiple times (30+) and was wondering how I could either carry it out in a streamlined fashion or create a function to speed it up?</p>
  
  <p>Current Approach:</p>
  
  <pre><code>model           &lt;- loess(mpg ~ wt, data=mtcars)
  xrange          &lt;- range(mtcars$wt)
  xseq            &lt;- seq(from=xrange[1], to=xrange[2], length=100)
  pred            &lt;- predict(model, newdata = data.frame(wt = xseq), se=TRUE)
  y               &lt;- pred$fit
  loess.DF_mtcars &lt;- data.frame(x = xseq, y=y)
  </code></pre>
  
  <p>Thanks</p>