# How to use all variable in @formula like R language?

**URL:** <https://discourse.julialang.org/t/how-to-use-all-variable-in-formula-like-r-language/88031>\
**Category:** New to Julia\
**Created:** [September 30, 2022, 10:20am UTC](https://discourse.julialang.org/t/how-to-use-all-variable-in-formula-like-r-language/88031 "2022-09-30T10:20:37Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [September 30, 2022, 10:40am UTC](https://discourse.julialang.org/t/how-to-use-all-variable-in-formula-like-r-language/88031/2 "2022-09-30T10:40:22Z")

</div>

dup of

> [@Using all independent variables with @formula in a multiple linear model](https://discourse.julialang.org/t/using-all-independent-variables-with-formula-in-a-multiple-linear-model/43691/3):
>
> Edit2: Ok, is working now but I need to use your solution in the in the lm() directly, instead of being able to create a @formula variable. would be nice to be able to do a @formula variable, specially for cross validation and other that need to work with that. But for the time being, thank you again. Thanks, it was give me an error: LoadError: ArgumentError: non-call expression encountered: Term.(Symbol.(names(df[:, Not(:Y]))) but I solve it creating a variable with the sum of the independ…

---

_[View the full topic](https://discourse.julialang.org/t/how-to-use-all-variable-in-formula-like-r-language/88031)._
