I have several X variables and I found a way how to choose the best model based on R2 using leaps package (https://rstudio-pubs-static.s3.amazonaws.com/2897_922
leaps