I've 10 predictors and 1 response variable. I tried running linear model using
If I just need to remove one predictor 'age', I can write
If the summary of the model suggest that more than one variables are not significantly contributing to the model. How can I efficiently write a code for linear model removing these variables.
lm(y.-c(age, weight), data=mydata)
But I got the error
Error in model.frame.default(formula = y ~ . - c(age, weight), : variable lengths differ (found for 'c(age, weight)')