How to pass a function in a variable inside a linear regression?

Hi, im trying to replicate this excercises in R, but in Julia and wanted to know if there’s a way to do what they did in 2.2, that is, passing a linear model the next way

linearRegressor = lm(log(dependente variable ) ~ independent variables, dataset)

I had to create a new column in my dataset with

dataset.column = log.(dataset.column)

to solve the problem, but wanted to know if Julia have a way to do this.

Thank for any help.

Did you try it? It should work.

julia> lm(@formula(log(y) ~ x), df)

:(log(y)) ~ 1 + x

              Estimate  Std. Error   t value  Pr(>|t|)  Lower 95%  Upper 95%
(Intercept)  0.37625     0.0381661  9.85821     <1e-15   0.30051    0.451989
x            0.0331787   0.0735028  0.451394    0.6527  -0.112685   0.179043

Thanks, I had tried originally as

fm = @formula(log.(y) ~ x)

and that gave an error and didn’t tough was the β€œ.” the cause it.