title: Linear regression between columns and by index
body: <pre><code>HEALTH  CONINC  MARITAL Index MARITAL2                    HAPPY
  3           441 5        1            2                        3
  1          1764 5        1            2                        2
  2          3087 5        1            2                        2
  3          3087 5        2            2                        3
  1          3969 2        2            5                        1
  1          3969 5        2            2                        3
  2          4852 5        2            2                        2
  3          5734 3        2            3                        3
  </code></pre>
  
  <p>Is there anyway to get liner regression of each column with respect to one column(eg, Happy) while breakdown by index?</p>
  
  <p>Expected output would be Rsquare value:</p>
  
  <pre><code>HEALTH  CONINC  MARITAL Index MARITAL2   
   x       x       x         1      x      
   x       x       x         2      x      
  </code></pre>
  
  <p>Tried <code>lapply</code>, while not sure how to incorporate to regress by index. </p>