title: Getting the y-axis intercept and slope from a linear regression of multiple data and passing the intercept and slope values to a data frame
body: <p>I have a data frame <code>x1</code>, which was generated with the following piece of code,</p>
  
  <pre><code>x &lt;- c(1:10)
  y &lt;- x^3
  z &lt;- y-20
  s &lt;- z/3
  t &lt;- s*6
  q &lt;- s*y
  x1 &lt;- cbind(x,y,z,s,t,q)
  x1 &lt;- data.frame(x1)
  </code></pre>
  
  <p>I would like to extract the y-axis intercept and the slope of the linear regression fit for the data,</p>
  
  <pre><code>    x    y   z          s    t             q
  1   1    1 -19  -6.333333  -38     -6.333333
  2   2    8 -12  -4.000000  -24    -32.000000
  3   3   27   7   2.333333   14     63.000000
  4   4   64  44  14.666667   88    938.666667
  5   5  125 105  35.000000  210   4375.000000
  6   6  216 196  65.333333  392  14112.000000
  7   7  343 323 107.666667  646  36929.666667
  8   8  512 492 164.000000  984  83968.000000
  9   9  729 709 236.333333 1418 172287.000000
  10 10 1000 980 326.666667 1960 326666.666667 
  </code></pre>
  
  <p>I use the following codes to melt and plot three columns of data,</p>
  
  <pre><code>xm &lt;- melt(x1, id=names(x1)[1], measure=names(x1)[c(2, 4, 5)], variable = "cols")
  plt &lt;- ggplot(xm) +
      geom_point(aes(x=x,y= value, color=cols), size=3) +
      labs(x = "x", y = "y") 
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/BCtdA.png" alt="enter image description here"></p>
  
  <p>Now what I require is to get a linear least squares fit for all the data separately and store the resulting intercept and slope in a new data frame.</p>
  
  <p>I use <code>plt + geom_abline()</code> but I don't get the desired result. Could someone let me know how to resolve this.</p>