-
Notifications
You must be signed in to change notification settings - Fork 28
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
Allow logical math? #352
Comments
Sorry, I missed this issue.
Yes, it's odd. But I'm in the other side: I'd like to have a good reason to allow logicals with units. :) What's your use case?
Not really. The same issue happens with or without math with logicals. It's about how |
use case: I simply commonly multiply something with TRUE or FALSE rather than writing ifelse if its cleaner. I've large data.frames with instrument data and I feel it makes sense to set set some columns to logical (as its clear to the user). But once i am using the columns to calculate derived parameters i regret that choice as i can't simply do col1*<some_long_equation> but need to write an ifelse that requires further syntactic sugar.... I maintain it does make ifelse more sane. In 350 you wrote: that c(1,0,1,0,1) is likely actually a logical vector. So you want us to do: i would like to: or even just: [tangent: |
I can see why its odd, but I cannot see a good reason to block math with logicals (but have special cases for NA).
Of course, I can actually trick you anyway:
Apart from allowing simpler TRUE/FALSE conditionals, it also makes use with ifelse (issue #350) more sane.
But if it is too strange to allow all units, I think a logical values should at least behave as if it had dimensionless units instead of causing an error. FWIW it would clean up some code I have (I switched to my logical vars being integers now...).
The text was updated successfully, but these errors were encountered: