How to use zerocorr() while creating a formula?

I’m passing variables to put into formula in Julia from R. The way I construct formula is such:

effects = Symbol.(["asd","sdf","dfg"])
effects = :(+$(effects...))
dep_var = Symbol("depend_var")

julia> fm = @eval @formula($(dep_var) ~ $(effects))
Formula: depend_var ~ asd + sdf + dfg

The question is, how can I use zerocorr() with such variables?
If I’m passing it like this - @eval @formula($(var1) ~ zerocorr($(var2))), it does not create a right formula, zerocorr() is not interpreted as a call but is passed literally from what I understand.

First, while that works, it’s not the recommended way to create a formula programmatically; instead, it’s recommended to use sum(term.(effects)). EDIT: here’s the section in the StatsModels.jl docs on this: Modeling tabular data · StatsModels.jl

Second, that probably won’t work with zerocorr right now, because it’s not (easily) possible to create RE terms at run time. Programmatically Creating RE Terms · Issue #462 · JuliaStats/MixedModels.jl · GitHub

Third, keep in mind that zerocorr only makes sense for random effects where there’s more than one random term (intercept and one or more slopes). I don’t know what var2 is supposed to be in your example above, but if it’s not something like :(1 + a | g) then zerocorr wouldn’t make any sense anyway…