title: How to Loop/Repeat a Linear Regression in R
body: <p>I have figured out how to make a table in <code>R</code> with 4 variables, which I am using for multiple linear regressions.  The dependent variable (<code>Lung</code>) for each regression is taken from one column of a csv table of 22,000 columns.  One of the independent variables (<code>Blood</code>) is taken from a corresponding column of a similar table.</p>
  <p>Each column represents the levels of a particular gene, which is why there are so many of them.  There are also two additional variables (<code>Age</code> and <code>Gender</code> of each patient).  When I enter in the linear regression equation, I use <code>lm(Lung[,1] ~ Blood[,1] + Age + Gender)</code>, which works for one gene.</p>
  <p>I am looking for a way to input this equation and have R calculate all of the remaining columns for <code>Lung</code> and <code>Blood</code>, and hopefully output the coefficients into a table.</p>
  <p>Any help would be appreciated!</p>