title: Linear Regression and storing results in data frame
body: <p>I am running a linear regression on some variables in a data frame.  I'd like to be able to subset the linear regressions by a categorical variable, run the linear regression for each categorical variable, and then store the t-stats in a data frame.  I'd like to do this without a loop if possible.</p>
  
  <p>Here's a sample of what I'm trying to do:</p>
  
  <pre><code>  a&lt;-  c("a","a","a","a","a",
           "b","b","b","b","b",
           "c","c","c","c","c")     
    b&lt;-  c(0.1,0.2,0.3,0.2,0.3,
           0.1,0.2,0.3,0.2,0.3,
           0.1,0.2,0.3,0.2,0.3)
    c&lt;-  c(0.2,0.1,0.3,0.2,0.4,
           0.2,0.5,0.2,0.1,0.2,
           0.4,0.2,0.4,0.6,0.8)
        cbind(a,b,c)
  </code></pre>
  
  <p>I can begin by running the following linear regression and pulling the t-statistic out very easily:</p>
  
  <pre><code>  summary(lm(b~c))$coefficients[2,3]
  </code></pre>
  
  <p>However, I'd like to be able to run the regression for when column a is a, b, or c.  I'd like to then store the t-stats in a table that looks like this:</p>
  
  <pre><code>variable t-stat
  a        0.9
  b        2.4
  c        1.1
  </code></pre>
  
  <p>Hope that makes sense.  Please let me know if you have any suggestions! </p>