Use the leaps package to generate the best subsets.
fitbest(formula, data, nbest = 10, ...)
model formula
data frame
number of subsets of each size to record
other arguments passed to regsubsets
# NOT RUN {
y <- swiss$Fertility
mods <- fitbest(Fertility ~ ., swiss)
# }
Run the code above in your browser using DataLab