I'm wasting a lot of time building intricate control structures to avoid the horror that is:
character(0)and friends (empty objects)
I understand these are all, in principle, different things, but for some uses in pkg development (such as naming or labelling stuff), they're really all the same.
Perhaps with additional arguments, so it could be used in a more fine-grained way?
is_nullish( x, empty = TRUE, # would indicate that a character(0) etc would be considered nullish emptry_str = TRUE, null = TRUE, na = TRUE, nan = TRUE )
Such fine-grained control would allow users (and devs) to easily adjust what exactly they mean with some fuzzy
- @Gabor's falsy goes pretty far, but it's not fine grained and @Gabor seems to have retired development on it.
- Paul Hendrick's
functools::existy(), though that also does a lot of FP stuff (which is great, but a little too heavyweight perhaps)
@lionel and @hadley's
rtools::is_empty()though (parts of) rlang are not safe for pkg dev as I undderstand.
Do other people have the same need or am I doing something wrong?
Such a tool could save me a lot of lines and bugs.
I'm looking for a tool that:
- is lightweight and robust
- plays nice with the tidyverse (especially purrr)
- is perhaps a part of a broader package of predicates (I often find myself hunting around the tidyverse and base for elegant, robust predicates ...)