I want to make a dataframe that has only the columns that appear in the formula. How can I get the list of terms from a formula?

```
@formula(y ~ a + b + c * d + e + e ^ 2)
```

I want to make a dataframe that has only the columns that appear in the formula. How can I get the list of terms from a formula?

```
@formula(y ~ a + b + c * d + e + e ^ 2)
```

There’s an internal function called `termvars`

that should do it, something like:

```
f = @formula(y ~ a + b + c * d + e + e ^ 2)
f_data = select(data, StatsModels.termvars(f))
```

That’s what we currently use to get the table columns in StatsModels.jl/modelframe.jl at 0d0c2bbd56b183491e8c831a92168d4265e4ea68 · JuliaStats/StatsModels.jl · GitHub