-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove tilde macro from formula interface #116
Comments
I wouldn't remove it until the discussion settles. It isn't clear to me yet what's going to happen to Also, the syntax you suggest is rather verbose, we might as well directly work with expressions: |
I'm okay with changing the model formula specification if that is the conclusion once the dust settles, as @nalimilan said. I can adjust the Naturally the By the way, I have settled on a numerical approach in the |
At this point I'm in favor of something like |
@StefanKarpinski The model formula is generally used as an argument to a function like Initially we used an expression, like The point of the exercise is to be able to parse the expression into a left hand side and a right hand side where terms on the right hand side can have special meanings and the evaluation is done in an environment determined by the In some ways I think I would prefer to return to the expression syntax instead of creating a special purpose macro, which, in most cases, would need to be written |
In the past I proposed that this should be a custom string literal that uses df = DataFrame(X1=randn(10), X2=randn(10))
Y = randn(10)
fit(GeneralizedLinearModel, model"$Y ~ X1 + X2", df) |
I've thought about the custom string literal, but it has the drawback that highlighting is lost. Since a formula is valid Julia syntax, I don't see the point of putting it inside a string. (Also, more fundamentally but quite OT, I don't think we should support accessing variables outside of the data frame argument as in R: in my experience, it's a nightmare for package authors, and doesn't really bring any real advantage. It's even confusing for students who have objects in the global scale and variables with the same name in the data frame, and modify only one of the two.) What's the issue with the |
I agree with Doug that it's a bit of an R smell, and he is correct that we would have to use The main advantage of the |
Just adding my $0.02: indeed, having @~ lurking around as a special case macro is a slippery slope. Support infix macros in general or not at all. |
This discussion continues in JuliaStats/StatsModels.jl#3 |
I think we should get rid of the tilde macro: it is way too inconsistent with the rest of the language (see discussion in JuliaLang/julia#4882), and takes up a valuable keyboard ASCII symbol. One simple way to replace it is to use a wrapping macro:
but there might be something better?
This would also affect MixedModels.jl: are there any other packages which use it?
cc: @johnmyleswhite, @dmbates
The text was updated successfully, but these errors were encountered: