Suppose I have a response variable and a data containing three covariates (as a toy example):
y = c(1,4,6) d = data.frame(x1 = c(4,-1,3), x2 = c(3,9,8), x3 =
You can check the package leaps and in particular the function regsubsets() functions for model selection. As stated in the documentation:
leaps
regsubsets()
Model selection by exhaustive search, forward or backward stepwise, or sequential replacement