Hadley Wickham
Hadley Wickham
And generalise so that they can take any number of columns, as in https://github.com/tidyverse/dplyr/issues/4482
This should work, but I can't immediately understand why it doesn't: ``` r library(dplyr, warn.conflicts = FALSE) df % mutate(a = coalesce(!!!across(-id))) #> Error in .subset2(chunks, self$get_current_group()): attempt to select...
I think we have to keep supporting negative values in order to not break existing dplyr code. And I'm pretty sure we have to return the default value for OOB...
Can more efficiently implement this (for the default case where `default` is a missing value) by using `vec_slice(x, c(NA, idx))` etc.
And consider unify into a single function, as in https://github.com/tidyverse/dplyr/issues/5260
Would this be more natural in purrr?
Also, how do you want to handle ties? Would it be better for `Mode` to return a vector?
Yeah, you need `isTRUE(all.equal(x, y))`. Here, I think I was thinking more about the floating point approximation and type coercion parts of `all.equal()` rather than the descriptive messages.
Another insight: in expressions like `x == "a"` where you're comparing a vector with a scalar, I would be more performance to coerce the scalar to the same type as...
Remember the existence of `vec_proxy_equality()` and the C function `vctrs_equal()`. But `vctrs_equal()` doesn't have quite the right equality semantics since we'd compare doubles with tolerance, and NA shouldn't equal NA....