markfairbanks / tidytable

Tidy interface to 'data.table'
https://markfairbanks.github.io/tidytable/
Other
450 stars 32 forks source link

Inconsistent `na_if` #689

Closed statzhero closed 1 year ago

statzhero commented 1 year ago

This seems not good. Thoughts?

> dplyr::na_if(1:5, 5:1)
[1]  1  2 NA  4  5

> tidytable::na_if(1:5, 5:1)
[1] NA NA NA NA NA
markfairbanks commented 1 year ago

Ah that's not good. Looks like I built the wrong logic for when length(y) > 1.

markfairbanks commented 1 year ago

All fixed - thanks for catching this.

tidytable::na_if(1:5, 5:1)
#> [1]  1  2 NA  4  5