tidyverse / funs

Collection of low-level functions for working with vctrs
Other
34 stars 7 forks source link

`between()` should recycle `left` and `right` to the size of `x` #74

Closed DavisVaughan closed 2 years ago

DavisVaughan commented 2 years ago

And MAYBE also cast them to the type of x, but that is possibly more useful, even if occasionally confusing

# pak::pak("r-lib/funs")

library(funs)

# This shouldnt recycle `x`.
# We want something with the same size as `x` in the end.
x <- 1
between(x, 1:5, 1:5)
#> [1]  TRUE FALSE FALSE FALSE FALSE

# Not entirely sure about this.
# Should it try to cast left/right to type of x? And fail here?
x <- 1:5
between(x, -1.5, 3.5)
#> [1]  TRUE  TRUE  TRUE FALSE FALSE

Created on 2022-04-16 by the reprex package (v2.0.1)