Reputation: 1
Trying to run the function
CatFit1<-lm(PRICE~BATHS+BEDS+ 'SQUARE FEET'+CatLotData2$LotCat+
'YEAR BUILT'+CatLotData2$NeighCat, data=CatLotData2)
but getting this error message:
Error in terms.formula(formula, data = data) :
invalid model formula in ExtractVars
Anyone have an idea of the problem?
Upvotes: 0
Views: 7566
Reputation: 269644
If there are spaces in the variable names surround them with backticks, not single quotes. For example,
PRICE ~ BATHS + BEDS + `SQUARE FEET`
The other possibility is to change the names so that they don't have spaces in them in the first place.
Upvotes: 2