Error in model.frame.default



I am currently working on linear regression problem but when I am modeling the model quality vs rest of variable I am getting the error


Your syntax is wrong when building the model.

Try this
ml <- lm(quality~.,data=white)

The above command means dependent variable is quality. “.” stands for all variables.

You cannot write quality~white[,-12] : because you need to supply the names of variables to be used as predictors for the model not the whole matrix intself. We supply that through data = white.


If you do not want all other variables, you can also separate the variables that you would like to test against by a plus sign on the RHS of the formula like:

lm(quality ~ fixed.acidity + volatile.acidity + chloride, white)