-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Rewrite na_if()
using vctrs
#6329
Merged
DavisVaughan
merged 5 commits into
tidyverse:main
from
DavisVaughan:feature/na-if-vctrs
Jul 19, 2022
Merged
Rewrite na_if()
using vctrs
#6329
DavisVaughan
merged 5 commits into
tidyverse:main
from
DavisVaughan:feature/na-if-vctrs
Jul 19, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These changes broke 10 revdeps (see #6262), but all of them are off-label usage of
I think we should press forward with this and just make PRs for them since all of them are bugs. I updated the NEWS bullet to call out the |
hadley
reviewed
Jul 13, 2022
9cc0985
to
73b96f4
Compare
d9c2753
to
3987b5b
Compare
hadley
approved these changes
Jul 19, 2022
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We talked about making
na_if()
work in a match-like way, likena_if(x, c("bad", "NA"))
, but I no longer think we should do that. While that might be more useful, I think:It would break existing code where people are currently supplying vector
y
values and expect==
to be used, which does seem to come up on a quick GitHub scanIt would no longer match
NULLIF()
from SQL, which it is advertised as mimicking. The Microsoft SQL docs state thatNULLIF(e1, e2)
should be treated as a "searched CASE expression", meaning that the following should be exactly equivalenthttps://docs.microsoft.com/en-us/sql/t-sql/language-elements/nullif-transact-sql?view=sql-server-ver16#remarks
If people want a match-like
na_if()
, we could addreplace_match(x, c("bad", "NA") ~ NA)
as part of #6328Other notes on what changes from this update:
y
to the type ofx
, with the intention of making it very clear that this is type stable onx
vec_equal()
for comparisonvec_assign()
for assignment"9c7db457-e0e3-4d62-8d92-1a8af03dae11"