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,
lm(goal ~ ., data = df)
I get this error:
Error in
contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels
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?