This may be a very simple problem, but I can't seem to get past it. Have column names such as X100.4, X100.-4, X100.-5 so on. I'm trying to run a linear regression but when I do this I get an error
lm<-lm(X986~X241+X243+X280+X282+X987+X143.2+X239.0+X491.61+X350.-4,data=train)
Error in terms.formula(formula, data = data) :
invalid model formula in ExtractVars
it works fine without the variable X350.-4, so I'm assuming it's the problem. I tried doing 'X350.-4' and "X350.-4", but this yielded the same error. I also tried doing "" for all of the variables but this also did not work.
You can use backticks:
But it would be better to sanitize the names: