Get list of columns from formula

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)

cc @dave.f.kleinschmidt

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 https://github.com/JuliaStats/StatsModels.jl/blob/0d0c2bbd56b183491e8c831a92168d4265e4ea68/src/modelframe.jl#L70