-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Handle missing values in clamp #31066
Conversation
I feel we should correctly handle Missings in all positions,
In 1.0.3 they all error |
@KristofferC are your 👎 reactions due to this being another case of extending a function just to support missing values? |
Yes, especially seeing the suggestion for all the permutations of the arguments. |
Man, we really need a generic way to handle this kind of thing instead of people wanting to add all the methods for |
This is an interesting example of why it's hard to do generically though. One missing argument doesn't necessarily imply the result has to be missing. |
I purposefully left that out due to the ambiguity. If the value you're trying to clamp is missing, the result should unambiguously be missing. But does it make sense to try to clamp a non-missing value between something you know and something you don't know? You could go by how |
I don't think that would be consistent with the way we treat missing everywhere else. We've been pretty clear that But it sounds fine to only define methods for the first argument. I just wanted to point that it would make sense to always return |
0d6770d
to
0513b19
Compare
Bump. This seems useful behaviour (the simple "clamping a |
Yes, we should do this, then open an issue to discuss the other cases I rose |
0513b19
to
50ae2d8
Compare
Rebased. |
Two small points:
|
|
I agree |
This adds support for
clamp
ing missing values. The existingclamp
code errors onmissing
as it usesifelse
on comparisons that can returnmissing
. This came up in some private code.