-
Notifications
You must be signed in to change notification settings - Fork 13
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
Dealing with formula #339
Comments
Thanks @devSJR. As you probably know, the workaround here is to wrap with plt(I(mpg/hp) ~ wt, data = mtcars) ... but I certainly agree that consistency with vanilla |
The fact that If the blocks for
This is done the same way for the
So
I think that this behavior of base R is inconsistent and very confusing. Of course, it would be possible to mimic this behavior but I don't think we should do it. Instead we should be consistent in the processing of the left-hand side and right-hand side. Either by warning about this situation (current solution) or by using the arithmetic meaning for both the The latter would create another inconsistency, though, namely that So to cut a long story short: My opinion is that |
Some additional side remarks (aka rant). Feel free to ignore this, it's not really related to formulas for plotting:
|
If we want to disable the symbolic interpretation of the formula operators in
The default
But then we can switch to
Thus, with that modification we could turn off the symbolic interpretation of the So the changes to the code are really minimal and with can easily implement any of the following strategies:
My personal preference is (1) >> (3) > (2). But if Grant and/or Vincent clearly prefer consistency with base R, I'm also willing to implement that 😜 |
…ymbolic interpretation of formula parts (discussed in #339)
I started my morning with a coffee, an additional side remarks (aka rant) and finished with a smile. I think a small section in the vignette (even verbatim of this discussion here) would do the trick. |
Thanks for the nice words - and thanks for raising the issue in the first place! After some sleep, I also don't file quite as strongly about strategy 2. So if Grant decides that he wants to go with consistency with base R, I'm also very fine with that 😇 |
I defer to to @zeileis on all matters related to formulae! In seriousness, this is a great discussion with excellent points. The base inconsistency of Summarizing... @zeileis I think you make a perfectly compelling case that we should leave the current behaviour as-is, perhaps with some additional documentation or an example (as suggested by @devSJR). I can see that you've opened a branch that would enable users to select into the alternative |
I will keep watching this. I guess more users will come across this, and they will certainly be able to find the symbolic parameter. Moreover, examples in the example section are always great. Actually, they are better than the vignette! I tell my students to go the examples first. I guess others do the same. |
OK, good, let's stick with the current behavior then. We could also expand the error message, e.g.,
or something along those lines? As for However, in the meantime I thought of one problem that the current implementation does not cover: arithmetic operators in combination with other functions, e.g., So if we stick to the current behavior, I would probably just discard the |
I must confess I haven't been keeping track of all the ins and outs here, and I desparately need to switch to "day job" work now as I've got a bunch of looming deadlines. @zeileis my feeling is that I'm happy with whatever you think is best. So I'll leave you to close this issue or resolve in whatever fashion you feel is most appropriate. |
Hello. It would be great if tinyplot can deal with more complex formulas because it behaves different from base plot. I think this is on the to-do list. I just wanted to put it here
mtcars
par(mfrow = c(1,2))
plt(mpg/hp ~ wt, data = mtcars)
plot(mpg/hp ~ wt, data = mtcars)
The text was updated successfully, but these errors were encountered: