I am working with R.

I have a matrix called combination:

```
comb <- matrix( c(1,2,1,3,2,3) , nrow = 3 , ncol = 2)
n_comb<-3

```

I have a one column dataframe called y with the values of my y variable.

I have a 3 column dataframe called reg with 3 regressors.

I want to do a loop which regresses y on all possible combinations of reg, selecting each time two variables. Hopefully, I can store the values of the regression somewhere so that I can easily access them afterwards. For instance, I would like to store the R square of each regression, as well as the x variables employed associated with the R square value.

So far I have tried:

```
 for (i in 1:n_comb){
 *reg_simple <- select only the variables I need*
 all<-cbind (y,reg_simple)
 colnames(all)[1] <- "y"
 regression <-lm(y~.,all)
 summary (regression)
 *store the R square and the regressors somewhere*
 }

```

`