-
Notifications
You must be signed in to change notification settings - Fork 97
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
Use !anyNA() over all(!is.na(.)) #500
Conversation
`all(!(.))` is logically equivalent to `!any(.)`; in this case, that means we can use the specialized `anyNA()` instead as well
There's also an instance in Line 248 in 48b7543
Does this make a practical difference? - Are there examples of this being a performance bottleneck? |
to me it's about readability as much as performance -- I find "aggregate + negate" easier to process than "negate + aggregate". Came across it because our (very) old version was tripping the previous error from |
OK - I'll deal with this and the extra instance I found (plus a more thorough check for other instances than the GH search I did to find the Thanks :-) |
FWIW this will eventually be available as the the problem with writing all those linters is now I can't help but see them everywhere :) (PS in the meantime, I can run it manually and file PRs on any package if you'd like) |
Thanks @MichaelChirico |
Just a historic note:
It is more readable, though. The release note says that it may be faster for atomic vectors (without a class). |
Yep; I triggered the GH Actions checks for the PR to insure that we weren't inadvertently bumping the minimum version of R we require. |
all(!(.))
is logically equivalent to!any(.)
; in this case, that means we can use the specializedanyNA()
instead as well