I have a response variable `y`.  

Also I have a list of 5 dependent variables

```
x <- list(x1, x2, x3, x4, x5)

```

Lastly I have a Logical Vector z of length 5. E.g.

```
z <- c(TRUE, TRUE, FALSE, FALSE, TRUE)  

```

Given this I want R to automatically do linear Regression

```
lm(y ~ x1 + x2 + x5)

```

Basically the TRUE/FALSE correspond to whether to include the dependent variable or not.  

I am unable to do this.  

I tried doing `lm(y ~x[z])` but it does not work.