title: How to run linear regression on all variables when some columns are different classes
body: <p>I have over 1000 columns in my data frame. I want to run linear regression on all variables and do not want to write them one by one. When I try this, </p>
  
  <pre><code>lm(goal ~ ., data = df)
  </code></pre>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>Error in <code>contrasts&lt;-</code>(<code>*tmp*</code>, value = contr.funs[1 + isOF[nn]]) : 
      contrasts can be applied only to factors with 2 or more levels</p>
  </blockquote>
  
  <p>I have columns with character class, factors, numerics, etc. I am guessing I should remove columns that are cannot be variables. How do I do this?</p>