You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think while doing x == TRUE is bad practice, this is bound to trip up some users and an error should be thrown.
Additional context
Example of the error working correctly:
# version 1.1.4dplyr::filter(mtcars, cyl="4")
#> Error in `dplyr::filter()`:#> ! We detected a named input.#> ℹ This usually means that you've used `=` instead of `==`.#> ℹ Did you mean `cyl == "4"`?
Interestingly if the TRUE is in a vector the error is thrown.
dplyr::filter(mtcars, big_cyl= c(TRUE))
#> Error in `dplyr::filter()`:#> ! We detected a named input.#> ℹ This usually means that you've used `=` instead of `==`.#> ℹ Did you mean `big_cyl == c(TRUE)`?
The text was updated successfully, but these errors were encountered:
Currently dplyr warns users who accidentally use
=
instead of==
.However, this does not occur if a logical is passed as the named variable.
Demonstration
Correctly using
==
for comparisonI think while doing
x == TRUE
is bad practice, this is bound to trip up some users and an error should be thrown.Additional context
Example of the error working correctly:
Interestingly if the TRUE is in a vector the error is thrown.
The text was updated successfully, but these errors were encountered: