# How to get a GLM where formula is programmatically generated

**URL:** <https://discourse.julialang.org/t/how-to-get-a-glm-where-formula-is-programmatically-generated/43519>\
**Category:** New to Julia\
**Tags:** dataframes, glm\
**Created:** [July 22, 2020, 9:41pm UTC](https://discourse.julialang.org/t/how-to-get-a-glm-where-formula-is-programmatically-generated/43519 "2020-07-22T21:41:24Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![dave.f.kleinschmidt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dave.f.kleinschmidt/32/55_2.png) [@dave.f.kleinschmidt](https://discourse.julialang.org/u/dave.f.kleinschmidt)\
**Post date:** [September 1, 2020, 3:56pm UTC](https://discourse.julialang.org/t/how-to-get-a-glm-where-formula-is-programmatically-generated/43519/4 "2020-09-01T15:56:39Z")

</div>

@nilshg just added support for creating a `Term` from a string (available in [v0.6.14, which should automerge soon](https://github.com/JuliaRegistries/General/pull/20638)), so you can now do something like

```julia
terms = term.(names(data))
f = terms[1] ~ sum(terms[2:end]) # assuming first column is "y"
ols2 = lm(f, data)

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-get-a-glm-where-formula-is-programmatically-generated/43519)._
