Closed DavisVaughan closed 1 year ago
Thanks for the patches and the explanations! I simplified it further to x[NA]
, which seems to work.
There is a big difference between x[NA]
and x[NA_integer_]
. The first returns a missing vector the same size as the input, the second returns a size 1 missing vector.
x <- 1:5
x[NA]
#> [1] NA NA NA NA NA
x[NA_integer_]
#> [1] NA
Created on 2022-12-23 with reprex v2.0.2.9000
Thanks, it's fine either way.
This PR makes your package compatible with the next version of dplyr:
case_when()
andif_else()
now use vctrs, which generally makes them more permissive when there are varying types, but it resulted in two issues here:case_when()
can now only return vector types, which was the intention from the beginning. It was returning expressions in one of your use cases, but could easily be replaced with aswitch()
na_of_type()
function https://github.com/r-lib/vctrs/issues/1300. It is easier to just usex[NA_integer_]
as a generic way to get the same thing in a way that vctrs is okay with. More importantly, in the dev version of dplyr you can just useNA
so you won't need to worry about this at all after 1.1.0 is released! But for now we need the way I've done it to be compatible with dev and CRAN dplyr.We plan to submit dplyr 1.1.0 on January 27th.
This should be compatible with both dev and CRAN dplyr. It would help us out if you could go ahead and send a patch version of your package in ahead of time! Thanks!